#include "com_paranoidmonkey_ode_AndrODE.h"
#include <jni.h>
#include <android/log.h>

#define dSINGLE
#include <ode/ode.h>

//#define __VERBOSE

inline dSpaceID space(long handle){
	return (dSpaceID)(handle);
}
inline dMass* mass(long handle){
	return (dMass*)(handle);
}
inline dWorldID world(long handle){
	return (dWorldID)(handle);
}
inline dGeomID geom(long handle){
	return (dGeomID)(handle);
}
inline dBodyID body(long handle){
	return (dBodyID)(handle);
}
inline dJointID joint(long handle){
	return (dJointID)(handle);
}
inline dTriMeshDataID trimeshdata(long handle){
	return (dTriMeshDataID)(handle);
}
inline dJointGroupID jointgroup(long handle){
	return (dJointGroupID)(handle);
}
inline dHeightfieldDataID heightfielddata(long handle){
	return (dHeightfieldDataID)handle;
}

dJointID *toJointArray(JNIEnv *env,jlongArray arr){
	int count=env->GetArrayLength(arr);
	jlong *arr2=new jlong[count];
	env->GetLongArrayRegion(arr,0,count,arr2);

	dJointID *ret=new dJointID[count];
	for (int i=0;i<count;i++){
		ret[i]=joint(arr2[i]);
	}
	return ret;
}
double *toCArray(JNIEnv *env,jdoubleArray arr){
	int count=env->GetArrayLength(arr);
	double *ret=new double[count];
	env->GetDoubleArrayRegion(arr,0,count,ret);
	return ret;
}
float *toCArray(JNIEnv *env,jfloatArray arr){
	int count=env->GetArrayLength(arr);
	float *ret=new float[count];
	env->GetFloatArrayRegion(arr,0,count,ret);
	return ret;
}
int *toCArray(JNIEnv *env,jintArray arr){
	int count=env->GetArrayLength(arr);
	int *ret=new int[count];
	env->GetIntArrayRegion(arr,0,count,ret);
	return ret;
}
short *toCArray(JNIEnv *env,jshortArray arr){
	int count=env->GetArrayLength(arr);
	short *ret=new short[count];
	env->GetShortArrayRegion(arr,0,count,ret);
	return ret;
}
unsigned char *toCArray(JNIEnv *env,jbyteArray arr){
	int count=env->GetArrayLength(arr);
	signed char *ret=new signed char[count];
	env->GetByteArrayRegion(arr,0,count,ret);
	return (unsigned char*)ret;
}
float *toCArray(JNIEnv *env,jfloatArray arr,int count){
	float *ret=new float[count];
	env->GetFloatArrayRegion(arr,0,count,ret);
	return ret;
}

jfloatArray fromCArray(JNIEnv *env,float *arr,int count){
	jfloatArray ret=env->NewFloatArray(count);
	env->SetFloatArrayRegion(ret,0,count,arr);
	return ret;
}

#define MAT3SIZE 12
float* toMatrix3(JNIEnv *env,jfloatArray arr){
	float* ret=new float[MAT3SIZE];
	env->GetFloatArrayRegion(arr,0,MAT3SIZE,(float*)ret);
	return (float*)ret;
}
#define MAT4SIZE 16
float* toMatrix4(JNIEnv *env,jfloatArray arr){
	float* ret=new float[MAT4SIZE];
	env->GetFloatArrayRegion(arr,0,MAT4SIZE,(float*)ret);
	return (float*)ret;
}
#define QUATSIZE 4
float* toQuaternion(JNIEnv *env,jfloatArray arr){
	float *ret=new float[QUATSIZE];
	env->GetFloatArrayRegion(arr,0,QUATSIZE,(float*)ret);
	return (float*)ret;
}

#define VEC3SIZE 3
float* toVec3(JNIEnv *env,jfloatArray arr){
	float* ret=new float[VEC3SIZE];
	env->GetFloatArrayRegion(arr,0,VEC3SIZE,(float*)ret);
	return (float*)ret;
}
#define VEC4SIZE 4
float* toVec4(JNIEnv *env,jfloatArray arr){
	float* ret=new float[VEC4SIZE];
	env->GetFloatArrayRegion(arr,0,VEC4SIZE,(float*)ret);
	return (float*)ret;
}

jfloatArray Mat3toFloatArray(JNIEnv *env,dMatrix3 mat){
	jfloatArray ret=env->NewFloatArray(MAT3SIZE);
	env->SetFloatArrayRegion(ret,0,MAT3SIZE,(float*)mat);
	return ret;
}
jfloatArray Mat4toFloatArray(JNIEnv *env,dMatrix4 mat){
	jfloatArray ret=env->NewFloatArray(MAT4SIZE);
	env->SetFloatArrayRegion(ret,0,MAT4SIZE,(float*)mat);
	return ret;
}
jfloatArray QuattoFloatArray(JNIEnv *env,dQuaternion mat){
	jfloatArray ret=env->NewFloatArray(QUATSIZE);
	env->SetFloatArrayRegion(ret,0,QUATSIZE,(float*)mat);
	return ret;
}
jfloatArray Vec3toFloatArray(JNIEnv *env,dVector3 mat){
	jfloatArray ret=env->NewFloatArray(VEC3SIZE);
	env->SetFloatArrayRegion(ret,0,VEC3SIZE,(float*)mat);
	return ret;
}
jfloatArray Vec4toFloatArray(JNIEnv *env,dVector4 mat){
	jfloatArray ret=env->NewFloatArray(VEC4SIZE);
	env->SetFloatArrayRegion(ret,0,VEC4SIZE,(float*)mat);
	return ret;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomDestroy(JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomDestroy");
#endif
	dGeomDestroy(geom(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomSetData(JNIEnv *env, jclass obj, jlong handle, jobject data){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomSetData");
#endif
	dGeomSetData(geom(handle),data);
}

JNIEXPORT jobject JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomGetData(JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomGetData");
#endif
	return (jobject)dGeomGetData(geom(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomSetBody(JNIEnv *env, jclass obj, jlong handle, jlong bodyhandle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomSetBody");
#endif
	dGeomSetBody(geom(handle),body(bodyhandle));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomGetBody(JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomGetBody");
#endif
	return (jlong)dGeomGetBody(geom(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomSetPosition(JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomSetPosition");
#endif
	dGeomSetPosition(geom(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomSetRotation(JNIEnv *env, jclass obj, jlong handle, jfloatArray r){
	float *R=toCArray(env,r,12);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomSetRotation");
#endif
	dGeomSetRotation(geom(handle),R);
	delete R;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomSetQuaternion(JNIEnv *env, jclass obj, jlong handle, jfloatArray q){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomSetQuaternion");
#endif
	float *Q=toCArray(env,q,4);
	dGeomSetQuaternion(geom(handle),Q);
	delete Q;
}

JNIEXPORT jfloatArray JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomGetPosition(JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomGetPosition");
#endif
	float *ret=(float*)dGeomGetPosition(geom(handle));
	return fromCArray(env,ret,4);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomCopyPosition(JNIEnv *env, jclass obj, jlong handle, jfloatArray p){
	float *P=new float[4];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomCopyPosition");
#endif
	dGeomCopyPosition(geom(handle),P);
	env->SetFloatArrayRegion(p,0,4,P);
	delete p;
}

JNIEXPORT jfloatArray JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomGetRotation(JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomGetPosition");
#endif
	float *ret=(float*)dGeomGetRotation(geom(handle));
	return fromCArray(env,ret,12);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomCopyRotation(JNIEnv *env, jclass obj, jlong handle, jfloatArray retArr){
	float *ret=new float[12];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomCopyRotation");
#endif
	dGeomCopyRotation(geom(handle),ret);
	env->SetFloatArrayRegion(retArr,0,12,ret);
	delete ret;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomGetQuaternion(JNIEnv *env, jclass obj, jlong handle, jfloatArray retArr){
	float *ret=new float[4];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomGetQuaternion");
#endif
	dGeomGetQuaternion(geom(handle),ret);
	env->SetFloatArrayRegion(retArr,0,4,ret);
	delete ret;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomGetAABB (JNIEnv *env, jclass obj, jlong handle, jfloatArray retArr){
	float *ret=new float[6];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomGetAABB");
#endif
	dGeomGetAABB(geom(handle),ret);
	env->SetFloatArrayRegion(retArr,0,6,ret);
	delete ret;
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomIsSpace (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomIsSpace");
#endif
	return dGeomIsSpace(geom(handle));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomGetSpace (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomGetSpace");
#endif
	return (jlong)dGeomGetSpace(geom(handle));
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomGetClass (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomGetClass");
#endif
	return dGeomGetClass(geom(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomSetCategoryBits (JNIEnv *env, jclass obj, jlong handle, jlong bits){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomSetCategoryBits");
#endif
	dGeomSetCategoryBits(geom(handle),bits);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomSetCollideBits (JNIEnv *env, jclass obj, jlong handle, jlong bits){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomSetCollideBits");
#endif
	dGeomSetCollideBits(geom(handle),bits);
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomGetCategoryBits (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomGetCategoryBits");
#endif
	return dGeomGetCategoryBits(geom(handle));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomGetCollideBits(JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomGetCollideBits");
#endif
	return dGeomGetCollideBits(geom(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomEnable(JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomEnable");
#endif
	dGeomEnable(geom(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomDisable(JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomDisable");
#endif
	dGeomDisable(geom(handle));
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomIsEnabled (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomIsEnabled");
#endif
	return dGeomIsEnabled(geom(handle));
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomLowLevelControl (JNIEnv *env, jclass obj, jlong handle, jint controlClass, jint controlCode, jobject data, jintArray dataSize){
	int datasize;
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomLowLevelControl");
#endif
	return dGeomLowLevelControl(geom(handle),controlClass,controlCode,(void*)data,&datasize);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomGetRelPointPos (JNIEnv *env, jclass obj, jlong handle, jfloat px, jfloat py, jfloat pz, jfloatArray arr){
	float* res=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomGetRelPointPos");
#endif
	dGeomGetRelPointPos(geom(handle),px,py,pz,res);
	env->SetFloatArrayRegion(arr,0,3,res);
	delete res;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomGetPosRelPoint (JNIEnv *env, jclass obj, jlong handle, jfloat px, jfloat py, jfloat pz, jfloatArray arr){
	float* res=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomGetPosRelPoint");
#endif
	dGeomGetPosRelPoint(geom(handle),px,py,pz,res);
	env->SetFloatArrayRegion(arr,0,3,res);
	delete res;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomVectorToWorld (JNIEnv *env, jclass obj, jlong handle, jfloat px, jfloat py, jfloat pz, jfloatArray arr){
	float* res=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomVectorToWorld");
#endif
	dGeomVectorToWorld(geom(handle),px,py,pz,res);
	env->SetFloatArrayRegion(arr,0,3,res);
	delete res;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomVectorFromWorld (JNIEnv *env, jclass obj, jlong handle, jfloat px, jfloat py, jfloat pz, jfloatArray arr){
	float* res=new float[4];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomVectorFromWorld");
#endif
	dGeomVectorFromWorld(geom(handle),px,py,pz,res);
	env->SetFloatArrayRegion(arr,0,3,res);
	delete res;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomSetOffsetPosition(JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomSetOffsetPosition");
#endif
	dGeomSetOffsetPosition(geom(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomSetOffsetRotation (JNIEnv *env, jclass obj, jlong handle, jfloatArray r){
	float* R=toMatrix3(env,r);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomSetOffsetRotation");
#endif
	dGeomSetOffsetRotation(geom(handle),R);
	delete R;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomSetOffsetQuaternion (JNIEnv *env, jclass obj, jlong handle, jfloatArray q){
	float* Q=toQuaternion(env,q);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomSetOffsetQuaternion");
#endif
	dGeomSetOffsetQuaternion(geom(handle),Q);
	delete Q;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomSetOffsetWorldPosition (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomSetOffsetWorldPosition");
#endif
	dGeomSetOffsetWorldPosition(geom(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomSetOffsetWorldRotation(JNIEnv *env, jclass obj, jlong handle, jfloatArray r){
	float* R=toMatrix3(env,r);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomSetOffsetWorldRotation");
#endif
	dGeomSetOffsetWorldRotation(geom(handle),R);
	delete R;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomSetOffsetWorldQuaternion (JNIEnv *env, jclass obj, jlong handle, jfloatArray q){
	float* Q=toQuaternion(env,q);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomSetOffsetWorldQuaternion");
#endif
	dGeomSetOffsetWorldQuaternion(geom(handle),Q);
	delete Q;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomClearOffset (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomClearOffset");
#endif
	dGeomClearOffset(geom(handle));
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomIsOffset (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomIsOffset");
#endif
	return dGeomIsOffset(geom(handle));
}

JNIEXPORT jfloatArray JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomGetOffsetPosition (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomGetOffsetPosition");
#endif
	float *ret=(float*)dGeomGetOffsetPosition(geom(handle));
	return fromCArray(env,ret,4);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomCopyOffsetPosition (JNIEnv *env, jclass obj, jlong handle, jfloatArray retArr){
	float *ret=new float[4];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomCopyOffsetPosition");
#endif
	dGeomCopyOffsetPosition(geom(handle),ret);
	env->SetFloatArrayRegion(retArr,0,env->GetArrayLength(retArr),ret);
	delete ret;
}

JNIEXPORT jfloatArray JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomGetOffsetRotation (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomGetOffsetRotation");
#endif
	float *ret=(float*)dGeomGetOffsetRotation(geom(handle));
	return fromCArray(env,ret,12);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomCopyOffsetRotation (JNIEnv *env, jclass obj, jlong handle, jfloatArray retArr){
	float *ret=new float[12];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomCopyOffsetRotation");
#endif
	dGeomCopyOffsetRotation(geom(handle),ret);
	env->SetFloatArrayRegion(retArr,0,env->GetArrayLength(retArr),ret);
	delete ret;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomGetOffsetQuaternion (JNIEnv *env, jclass obj, jlong handle, jfloatArray retArr){
	dQuaternion ret;
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomGetOffsetQuaternion");
#endif
	dGeomGetOffsetQuaternion(geom(handle),ret);
	env->SetFloatArrayRegion(retArr,0,env->GetArrayLength(retArr),ret);
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dCreateTriMesh(JNIEnv *env, jclass obj, jlong handle, jlong data){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dCreateTriMesh");
#endif
	return (jlong)dCreateTriMesh(space(handle),trimeshdata(data),0,0,0);
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dCreateSphere (JNIEnv *env, jclass obj, jlong handle, jfloat radius){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dCreateSphere");
#endif
	return (jlong)dCreateSphere(space(handle),radius);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomSphereSetRadius (JNIEnv *env, jclass obj, jlong handle, jfloat radius){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomSphereSetRadius");
#endif
	dGeomSphereSetRadius(geom(handle),radius);
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomSphereGetRadius (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomSphereGetRadius");
#endif
	return dGeomSphereGetRadius(geom(handle));
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomSpherePointDepth (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomSpherePointDepth");
#endif
	return dGeomSpherePointDepth(geom(handle),x,y,z);
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dCreateConvex (JNIEnv *env, jclass obj, jlong handle, jfloatArray planesArr, jint planecount, jfloatArray pointsArr, jint pointcount, jintArray polygonsArr){
	float *planes=toCArray(env,planesArr,planecount);
	float *points=toCArray(env,pointsArr,pointcount);
	int *polygons=toCArray(env,polygonsArr);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dCreateConvex");
#endif
	jlong ptr=(jlong)dCreateConvex(space(handle),planes,(unsigned int)planecount,points,(unsigned int)pointcount,(unsigned int*)polygons);
	delete planes;
	delete points;
	delete polygons;
	return ptr;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomSetConvex (JNIEnv *env, jclass obj, jlong handle, jfloatArray planesArr, jint planecount, jfloatArray pointsArr, jint pointcount, jintArray polygonsArr){
	float *planes=toCArray(env,planesArr,planecount);
	float *points=toCArray(env,pointsArr,pointcount);
	int *polygons=toCArray(env,polygonsArr);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomSetConvex");
#endif
	dGeomSetConvex(geom(handle),planes,(unsigned int)planecount,points,(unsigned int)pointcount,(unsigned int*)polygons);
	delete planes;
	delete points;
	delete polygons;
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dCreateBox (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dCreateBox");
#endif
	return (jlong)dCreateBox(space(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomBoxSetLengths (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomBoxSetLengths");
#endif
	dGeomBoxSetLengths(geom(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomBoxGetLengths (JNIEnv *env, jclass obj, jlong handle, jfloatArray arr){
	float *res=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomBoxGetLengths");
#endif
	dGeomBoxGetLengths(geom(handle),res);
	env->SetFloatArrayRegion(arr,0,3,res);
	delete res;
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomBoxPointDepth (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomBoxPointDepth");
#endif
	return dGeomBoxPointDepth(geom(handle),x,y,z);
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dCreatePlane (JNIEnv *env, jclass obj, jlong handle, jfloat a, jfloat b, jfloat c, jfloat d){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dCreatePlane");
#endif
	return (jlong)dCreatePlane(space(handle),a,b,c,d);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomPlaneSetParams (JNIEnv *env, jclass obj, jlong handle, jfloat a, jfloat b, jfloat c, jfloat d){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomPlaneSetParams");
#endif
	dGeomPlaneSetParams(geom(handle),a,b,c,d);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomPlaneGetParams (JNIEnv *env, jclass obj, jlong handle, jfloatArray arr){
	float *ret=new float[4];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomPlaneGetParams");
#endif
	dGeomPlaneGetParams(geom(handle),ret);
	env->SetFloatArrayRegion(arr,0,4,ret);
	delete ret;
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomPlanePointDepth (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomPlanePointDepth");
#endif
	return dGeomPlanePointDepth(geom(handle),x,y,z);
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dCreateCapsule (JNIEnv *env, jclass obj, jlong handle, jfloat radius, jfloat length){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dCreateCapsule");
#endif
	return (jlong)dCreateCapsule(space(handle),radius,length);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomCapsuleSetParams (JNIEnv *env, jclass obj, jlong handle, jfloat radius, jfloat length){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomCapsuleSetParams");
#endif
	dGeomCapsuleSetParams(geom(handle),radius,length);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomCapsuleGetParams (JNIEnv *env, jclass obj, jlong handle, jfloatArray radArr, jfloatArray lenArr){
	float radius,length;
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomCapsuleGetParams");
#endif
	dGeomCapsuleGetParams(geom(handle),&radius,&length);
	env->SetFloatArrayRegion(radArr,0,1,&radius);
	env->SetFloatArrayRegion(lenArr,0,1,&length);
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomCapsulePointDepth (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomCapsulePointDepth");
#endif
	return dGeomCapsulePointDepth(geom(handle),x,y,z);
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dCreateCylinder (JNIEnv *env, jclass obj, jlong handle, jfloat radius, jfloat length){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dCreateCylinder");
#endif
	return (jlong)dCreateCylinder(space(handle),radius,length);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomCylinderSetParams (JNIEnv *env, jclass obj, jlong handle, jfloat radius, jfloat length){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomCylinderSetParams");
#endif
	dGeomCylinderSetParams(geom(handle),radius,length);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomCylinderGetParams (JNIEnv *env, jclass obj, jlong handle, jfloatArray radArr, jfloatArray lenArr){
	float radius,length;
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomCylinderGetParams");
#endif
	dGeomCylinderGetParams(geom(handle),&radius,&length);
	env->SetFloatArrayRegion(radArr,0,1,&radius);
	env->SetFloatArrayRegion(lenArr,0,1,&length);
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dCreateRay (JNIEnv *env, jclass obj, jlong handle, jfloat length){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dCreateRay");
#endif
	return (jlong)dCreateRay(space(handle),length);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomRaySetLength (JNIEnv *env, jclass obj, jlong handle, jfloat length){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomRaySetLength");
#endif
	dGeomRaySetLength(geom(handle),length);
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomRayGetLength (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomRayGetLength");
#endif
	return dGeomRayGetLength(geom(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomRaySet (JNIEnv *env, jclass obj, jlong handle, jfloat px, jfloat py, jfloat pz, jfloat dx, jfloat dy, jfloat dz){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomRaySet");
#endif
	dGeomRaySet(geom(handle),px,py,pz,dx,dy,dz);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomRayGet (JNIEnv *env, jclass obj, jlong handle, jfloatArray startArr, jfloatArray dirArr){
	float *start=new float[4];
	float *dir=new float[4];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomRayGet");
#endif
	dGeomRayGet(geom(handle),start,dir);
	env->SetFloatArrayRegion(startArr,0,4,start);
	env->SetFloatArrayRegion(dirArr,0,4,dir);
	delete start;
	delete dir;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomRaySetParams (JNIEnv *env, jclass obj, jlong handle, jint firstcontact, jint backfacecull){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomRaySetParams");
#endif
	dGeomRaySetParams(geom(handle),firstcontact,backfacecull);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomRayGetParams (JNIEnv *env, jclass obj, jlong handle, jintArray firstcontact, jintArray backfacecull){
	int fc,bfc;
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomRayGetParams");
#endif
	dGeomRayGetParams(geom(handle),&fc,&bfc);
	env->SetIntArrayRegion(firstcontact,0,1,&fc);
	env->SetIntArrayRegion(backfacecull,0,1,&bfc);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomRaySetClosestHit (JNIEnv *env, jclass obj, jlong handle, jint closestHit){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomRaySetClosestHit");
#endif
	dGeomRaySetClosestHit(geom(handle),closestHit);
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomRayGetClosestHit (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomRayGetClosestHit");
#endif
	return dGeomRayGetClosestHit(geom(handle));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dCreateGeomTransform (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dCreateGeomTransform");
#endif
	return (jlong)dCreateGeomTransform(space(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomTransformSetGeom (JNIEnv *env, jclass obj, jlong handle, jlong handle2){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomTransformSetGeom");
#endif
	dGeomTransformSetGeom(geom(handle),geom(handle2));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomTransformGetGeom (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomTransformGetGeom");
#endif
	return (jlong)dGeomTransformGetGeom(geom(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomTransformSetCleanup (JNIEnv *env, jclass obj, jlong handle, jint cleanup){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomTransformSetCleanup");
#endif
	dGeomTransformSetCleanup(geom(handle),cleanup);
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomTransformGetCleanup (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomTransformGetCleanup");
#endif
	return dGeomTransformGetCleanup(geom(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomTransformSetInfo (JNIEnv *env, jclass obj, jlong handle, jint info){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomTransformSetInfo");
#endif
	dGeomTransformSetInfo(geom(handle),info);
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomTransformGetInfo (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomTransformGetInfo");
#endif
	return dGeomTransformGetInfo(geom(handle));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dCreateHeightfield (JNIEnv *env, jclass obj, jlong handle, jlong data, jint bPlaceable){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dCreateHeightfield");
#endif
	return (jlong)dCreateHeightfield(space(handle),heightfielddata(data),bPlaceable);
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomHeightfieldDataCreate (JNIEnv *env , jclass obj){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomHeightfieldDataCreate");
#endif
	return (jlong)dGeomHeightfieldDataCreate();
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomHeightfieldDataDestroy (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomHeightfieldDataDestroy");
#endif
	dGeomHeightfieldDataDestroy(heightfielddata(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomHeightfieldDataBuildByte__J_3BFFIIFFFI (JNIEnv *env, jclass obj, jlong handle, jbyteArray heightdataArr, jfloat width, jfloat depth, jint widthSamples, jint depthSamples, jfloat scale, jfloat offset, jfloat thickness, jint bWrap){
	unsigned char *heightdata=toCArray(env,heightdataArr);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomHeightfieldDataBuildByte");
#endif
	dGeomHeightfieldDataBuildByte(heightfielddata(handle),heightdata,1,width,depth,widthSamples,depthSamples,scale,offset,thickness,bWrap);
	delete heightdata;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomHeightfieldDataBuildShort__J_3SFFIIFFFI (JNIEnv *env, jclass obj, jlong handle, jshortArray heightdataArr, jfloat width, jfloat depth, jint widthSamples, jint depthSamples, jfloat scale, jfloat offset, jfloat thickness, jint bWrap){
	short *heightdata=toCArray(env,heightdataArr);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomHeightfieldDataBuildShort");
#endif
	dGeomHeightfieldDataBuildShort(heightfielddata(handle),heightdata,1,width,depth,widthSamples,depthSamples,scale,offset,thickness,bWrap);
	delete heightdata;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomHeightfieldDataBuildSingle__J_3FFFIIFFFI (JNIEnv *env, jclass obj, jlong handle, jfloatArray heightdataArr, jfloat width, jfloat depth, jint widthSamples, jint depthSamples, jfloat scale, jfloat offset, jfloat thickness, jint bWrap){
	float *heightdata=toCArray(env,heightdataArr);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomHeightfieldDataBuildSingle");
#endif
	dGeomHeightfieldDataBuildSingle(heightfielddata(handle),heightdata,1,width,depth,widthSamples,depthSamples,scale,offset,thickness,bWrap);
	delete heightdata;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomHeightfieldDataBuildDouble__J_3DFFIIFFFI (JNIEnv *env, jclass obj, jlong handle, jdoubleArray heightdataArr, jfloat width, jfloat depth, jint widthSamples, jint depthSamples, jfloat scale, jfloat offset, jfloat thickness, jint bWrap){
	double *heightdata=toCArray(env,heightdataArr);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomHeightfieldDataBuildDouble");
#endif
	dGeomHeightfieldDataBuildDouble(heightfielddata(handle),heightdata,1,width,depth,widthSamples,depthSamples,scale,offset,thickness,bWrap);
	delete heightdata;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomHeightfieldDataBuildByte__JLjava_nio_ByteBuffer_2IFFIIFFFI
 	(JNIEnv *env, jclass obj, jlong handle, jobject heightdataArr, jint bCopyData, jfloat width, jfloat depth, jint widthSamples, jint depthSamples, jfloat scale, jfloat offset, jfloat thickness, jint bWrap){
	unsigned char *heightdata=(unsigned char*)env->GetDirectBufferAddress( heightdataArr );
	if (heightdata!=NULL){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomHeightfieldDataBuildByte");
#endif
		dGeomHeightfieldDataBuildByte(heightfielddata(handle),heightdata,bCopyData,width,depth,widthSamples,depthSamples,scale,offset,thickness,bWrap);
	}
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomHeightfieldDataBuildShort__JLjava_nio_ShortBuffer_2IFFIIFFFI
 	(JNIEnv *env, jclass obj, jlong handle, jobject heightdataArr, jint bCopyData, jfloat width, jfloat depth, jint widthSamples, jint depthSamples, jfloat scale, jfloat offset, jfloat thickness, jint bWrap){
	short *heightdata=(short*)env->GetDirectBufferAddress( heightdataArr );
	if (heightdata!=NULL){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomHeightfieldDataBuildShort");
#endif
		dGeomHeightfieldDataBuildShort(heightfielddata(handle),heightdata,bCopyData,width,depth,widthSamples,depthSamples,scale,offset,thickness,bWrap);
	}
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomHeightfieldDataBuildSingle__JLjava_nio_FloatBuffer_2IFFIIFFFI
	(JNIEnv *env, jclass obj, jlong handle, jobject heightdataArr, jint bCopyData, jfloat width, jfloat depth, jint widthSamples, jint depthSamples, jfloat scale, jfloat offset, jfloat thickness, jint bWrap){
	float *heightdata=(float*)env->GetDirectBufferAddress( heightdataArr );
	if (heightdata!=NULL){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomHeightfieldDataBuildSingle");
#endif
		dGeomHeightfieldDataBuildSingle(heightfielddata(handle),heightdata,bCopyData,width,depth,widthSamples,depthSamples,scale,offset,thickness,bWrap);
	}
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomHeightfieldDataBuildDouble__JLjava_nio_DoubleBuffer_2IFFIIFFFI
	(JNIEnv *env, jclass obj, jlong handle, jobject heightdataArr, jint bCopyData, jfloat width, jfloat depth, jint widthSamples, jint depthSamples, jfloat scale, jfloat offset, jfloat thickness, jint bWrap){
	double *heightdata=(double*)env->GetDirectBufferAddress( heightdataArr );
	if (heightdata!=NULL){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomHeightfieldDataBuildDouble");
#endif
		dGeomHeightfieldDataBuildDouble(heightfielddata(handle),heightdata,bCopyData,width,depth,widthSamples,depthSamples,scale,offset,thickness,bWrap);
	}
}


JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomHeightfieldDataSetBounds (JNIEnv *env, jclass obj, jlong handle, jfloat minHeight, jfloat maxHeight){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomHeightfieldDataSetBounds");
#endif
	dGeomHeightfieldDataSetBounds(heightfielddata(handle),minHeight,maxHeight);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomHeightfieldSetHeightfieldData (JNIEnv *env, jclass obj, jlong handle, jlong handle2){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomHeightfieldSetHeightfieldData");
#endif
	dGeomHeightfieldSetHeightfieldData(geom(handle),heightfielddata(handle2));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomHeightfieldGetHeightfieldData (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomHeightfieldGetHeightfieldData");
#endif
	return (jlong)dGeomHeightfieldGetHeightfieldData(geom(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dClosestLineSegmentPoints (JNIEnv *env , jclass obj, jfloatArray A1, jfloatArray A2, jfloatArray B1, jfloatArray B2, jfloatArray CP1, jfloatArray CP2){
	float *a1=toCArray(env,A1);
	float *a2=toCArray(env,A2);
	float *b1=toCArray(env,B1);
	float *b2=toCArray(env,B2);
	float *cp1=new float[4];
	float *cp2=new float[4];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dClosestLineSegmentPoints");
#endif
	dClosestLineSegmentPoints(a1,a2,b1,b2,cp1,cp2);
	env->SetFloatArrayRegion(CP1,0,3,cp1);
	env->SetFloatArrayRegion(CP2,0,3,cp2);
	delete a1;
	delete a2;
	delete b1;
	delete b2;
	delete cp1;
	delete cp2;
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBoxTouchesBox (JNIEnv *env , jclass obj, jfloatArray P1, jfloatArray R1, jfloatArray SIDE1, jfloatArray P2, jfloatArray R2, jfloatArray SIDE2){
	float *p1=toCArray(env,P1);
	float *p2=toCArray(env,P2);
	float *r1=toCArray(env,R1);
	float *r2=toCArray(env,R2);
	float *side1=toCArray(env,SIDE1);
	float *side2=toCArray(env,SIDE2);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBoxTouchesBox");
#endif
	int ret=dBoxTouchesBox(p1,r1,side1,p2,r2,side2);
	delete p1;
	delete p2;
	delete r1;
	delete r2;
	delete side1;
	delete side2;
	return ret;
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBoxBox (JNIEnv *env , jclass obj, jfloatArray P1, jfloatArray R1, jfloatArray SIDE1, jfloatArray P2, jfloatArray R2, jfloatArray SIDE2, jfloatArray NORMAL, jfloatArray DEPTH, jintArray RETURN_CODE, jint flags, jlong CONTACT, jint skip){
	const float *p1=toCArray(env,P1);
	const float *p2=toCArray(env,P2);
	const float *r1=toCArray(env,R1);
	const float *r2=toCArray(env,R2);
	const float *side1=toCArray(env,SIDE1);
	const float *side2=toCArray(env,SIDE2);
	float *normal=toCArray(env,NORMAL);
	dContactGeom *contact=(dContactGeom*)CONTACT;
	float depth;
	int return_code;
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBoxBox");
#endif
	float ret=dBoxBox(p1,r1,side1,p2,r2,side2,normal,&depth,&return_code,flags,contact,skip);
	env->SetFloatArrayRegion(DEPTH,0,1,&depth);
	env->SetIntArrayRegion(RETURN_CODE,0,1,&return_code);

	delete p1;
	delete p2;
	delete r1;
	delete r2;
	delete side1;
	delete side2;

	return ret;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dInfiniteAABB (JNIEnv *env, jclass obj, jlong handle, jfloatArray AABB){
	float *aabb=toCArray(env,AABB);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dInfiniteAABB");
#endif
	dInfiniteAABB(geom(handle),aabb);
	delete aabb;
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dCreateGeomClass (JNIEnv *env , jclass obj, jlong classPtr){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dCreateGeomClass");
#endif
	return dCreateGeomClass((dGeomClass*)classPtr);
}

JNIEXPORT jobject JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomGetClassData (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomGetClassData");
#endif
	return (jobject)dGeomGetClassData(geom(handle));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dCreateGeom (JNIEnv *env , jclass obj, jint classnum){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dCreateGeom");
#endif
	return (jlong)dCreateGeom(classnum);
}

// end of Geom

// Space

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dSimpleSpaceCreate (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dSimpleSpaceCreate");
#endif
	return (jlong)dSimpleSpaceCreate(space(handle));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dHashSpaceCreate (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dHashSpaceCreate");
#endif
	return (jlong)dHashSpaceCreate(space(handle));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dQuadTreeSpaceCreate (JNIEnv *env, jclass obj, jlong handle, jfloatArray center, jfloatArray extents, jint depth){
	float *ctr=toCArray(env,center,4);
	float *ext=toCArray(env,extents,4);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dQuadTreeSpaceCreate");
#endif
	jlong ptr= (jlong)dQuadTreeSpaceCreate(space(handle),ctr,ext,depth);
	delete ctr;
	delete ext;
	return ptr;
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dSweepAndPruneSpaceCreate (JNIEnv *env, jclass obj, jlong handle, jint axisorder){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dSweepAndPruneSpaceCreate");
#endif
	return (jlong)dSweepAndPruneSpaceCreate(space(handle),axisorder);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dSpaceDestroy (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dSpaceDestroy");
#endif
	dSpaceDestroy(space(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dHashSpaceSetLevels (JNIEnv *env, jclass obj, jlong handle, jint minlevel, jint maxlevel){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dHashSpaceSetLevels");
#endif
	dHashSpaceSetLevels(space(handle),minlevel,maxlevel);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dHashSpaceGetLevels (JNIEnv *env, jclass obj, jlong handle, jintArray minArr, jintArray maxArr){
	int minlevel,maxlevel;
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dHashSpaceGetLevels");
#endif
	dHashSpaceGetLevels(space(handle),&minlevel,&maxlevel);
	env->SetIntArrayRegion(minArr,0,3,&minlevel);
	env->SetIntArrayRegion(maxArr,0,3,&maxlevel);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dSpaceSetCleanup (JNIEnv *env, jclass obj, jlong handle, jint mode){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dSpaceSetCleanup");
#endif
	dSpaceSetCleanup(space(handle),mode);
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dSpaceGetCleanup (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dSpaceGetCleanup");
#endif
	return dSpaceGetCleanup(space(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dSpaceSetSublevel (JNIEnv *env, jclass obj, jlong handle, jint sublevel){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dSpaceSetSublevel");
#endif
	dSpaceSetSublevel(space(handle),sublevel);
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dSpaceGetSublevel (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dSpaceGetSublevel");
#endif
	return dSpaceGetSublevel(space(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dSpaceSetManualCleanup (JNIEnv *env, jclass obj, jlong handle, jint mode){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dSpaceSetManualCleanup");
#endif
	dSpaceSetManualCleanup(space(handle),mode);
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dSpaceGetManualCleanup (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dSpaceGetManualCleanup");
#endif
	return dSpaceGetManualCleanup(space(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dSpaceAdd (JNIEnv *env, jclass obj, jlong handle, jlong handle2){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dSpaceAdd");
#endif
	dSpaceAdd(space(handle),geom(handle2));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dSpaceRemove (JNIEnv *env, jclass obj, jlong handle, jlong handle2){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dSpaceRemove");
#endif
	dSpaceRemove(space(handle),geom(handle2));
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dSpaceQuery (JNIEnv *env, jclass obj, jlong handle, jlong handle2){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dSpaceQuery");
#endif
	return dSpaceQuery(space(handle),geom(handle2));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dSpaceClean (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dSpaceClean");
#endif
	dSpaceClean(space(handle));
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dSpaceGetNumGeoms (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dSpaceGetNumGeoms");
#endif
	return dSpaceGetNumGeoms(space(handle));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dSpaceGetGeom (JNIEnv *env, jclass obj, jlong handle, jint i){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dSpaceGetGeom");
#endif
	return (jlong)dSpaceGetGeom(space(handle),i);
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dSpaceGetClass (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dSpaceGetClass");
#endif
	return dSpaceGetClass(space(handle));
}

// end of Space

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomTriMeshDataCreate (JNIEnv *env , jclass obj){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomTriMeshDataCreate");
#endif
	return (jlong)dGeomTriMeshDataCreate();
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomTriMeshDataDestroy (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomTriMeshDataDestroy");
#endif
	dGeomTriMeshDataDestroy(trimeshdata(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomTriMeshDataSet (JNIEnv *env, jclass obj, jlong handle, jint data_id, jobject data){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomTriMeshDataSet");
#endif
	dGeomTriMeshDataSet(trimeshdata(handle),data_id,data);
}

JNIEXPORT jobject JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomTriMeshDataGet (JNIEnv *env, jclass obj, jlong handle, jint data_id){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dddddd");
#endif
	return (jobject)dGeomTriMeshDataGet(trimeshdata(handle),data_id);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomTriMeshSetLastTransform (JNIEnv *env, jclass obj, jlong handle, jfloatArray lastTransArr){
	float *last_trans=toCArray(env,lastTransArr);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomTriMeshSetLastTransform");
#endif
	dGeomTriMeshSetLastTransform(geom(handle),last_trans);
}

JNIEXPORT jfloatArray JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomTriMeshGetLastTransform (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomTriMeshGetLastTransform");
#endif
	float *arr=dGeomTriMeshGetLastTransform(geom(handle));
	return Mat4toFloatArray(env,arr);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomTriMeshDataBuildSingle (JNIEnv *env, jclass obj, jlong handle, jfloatArray vrt, jint vertStride, jint vertCount, jintArray ind, jint indexCount, jint triStride){
	float *verts=toCArray(env,vrt);
	int *indices=toCArray(env,ind);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomTriMeshDataBuildSingle");
#endif
	dGeomTriMeshDataBuildSingle(trimeshdata(handle),verts,vertStride,vertCount,indices,indexCount,triStride);
	delete verts;
	delete indices;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomTriMeshDataBuildSingle1 (JNIEnv *env, jclass obj, jlong handle, jfloatArray vrt, jint vertStride, jint vertCount, jintArray ind, jint indexCount, jint triStride, jfloatArray nor){
	float *verts=toCArray(env,vrt);
	float *normals=toCArray(env,nor);
	int *indices=toCArray(env,ind);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomTriMeshDataBuildSingle1");
#endif
	dGeomTriMeshDataBuildSingle1(trimeshdata(handle),verts,vertStride,vertCount,indices,indexCount,triStride,normals);
	delete verts;
	delete normals;
	delete indices;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomTriMeshDataBuildDouble (JNIEnv *env, jclass obj, jlong handle, jdoubleArray vrt, jint vertStride, jint vertCount, jintArray ind, jint indexCount, jint triStride){
	double *verts=toCArray(env,vrt);
	int *indices=toCArray(env,ind);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomTriMeshDataBuildDouble");
#endif
	dGeomTriMeshDataBuildDouble(trimeshdata(handle),verts,vertStride,vertCount,indices,indexCount,triStride);
	delete verts;
	delete indices;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomTriMeshDataBuildDouble1 (JNIEnv *env, jclass obj, jlong handle, jdoubleArray vrt, jint vertStride, jint vertCount, jintArray ind, jint indexCount, jint triStride, jdoubleArray nor){
	double *verts=toCArray(env,vrt);
	double *normals=toCArray(env,nor);
	int *indices=toCArray(env,ind);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomTriMeshDataBuildDouble1");
#endif
	dGeomTriMeshDataBuildDouble1(trimeshdata(handle),verts,vertStride,vertCount,indices,indexCount,triStride,normals);
	delete verts;
	delete normals;
	delete indices;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomTriMeshDataBuildSimple (JNIEnv *env, jclass obj, jlong handle, jfloatArray vrt, jint vertCount, jintArray ind, jint indexCount){
	float *verts=toCArray(env,vrt);
	unsigned int *indices=(unsigned int*)toCArray(env,ind);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomTriMeshDataBuildSimple");
#endif
	dGeomTriMeshDataBuildSimple(trimeshdata(handle),verts,vertCount,indices,indexCount);
	delete verts;
	delete indices;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomTriMeshDataBuildSimple1 (JNIEnv *env, jclass obj, jlong handle, jfloatArray vrt, jint vertCount, jintArray ind, jint indexCount, jintArray nor){
	float *verts=toCArray(env,vrt);
	int *normals=toCArray(env,nor);
	unsigned int *indices=(unsigned int*)toCArray(env,ind);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomTriMeshDataBuildSimple1");
#endif
	dGeomTriMeshDataBuildSimple1(trimeshdata(handle),verts,vertCount,indices,indexCount,normals);
	delete verts;
	delete normals;
	delete indices;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomTriMeshDataPreprocess (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomTriMeshDataPreprocess");
#endif
	dGeomTriMeshDataPreprocess(trimeshdata(handle));
}
/*
JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomTriMeshDataGetBuffer (JNIEnv *env, jclass obj, jlong handle, jbyteArray BUF){
	int buflen;
	char *buf;
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomTriMeshDataGetBuffer");
#endif
	dGeomTriMeshDataGetBuffer(trimeshdata(handle),(unsigned char**)buf,&buflen);
	env->SetByteArrayRegion(BUF,0,buflen,buf);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomTriMeshDataSetBuffer (JNIEnv *env, jclass obj, jlong handle, jbyteArray BUF){
	int buflen=env->GetArrayLength(BUF);
	unsigned char *buf=toCArray(env,BUF);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomTriMeshDataSetBuffer");
#endif
	dGeomTriMeshDataSetBuffer(trimeshdata(handle),buf);
}
*/
JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomTriMeshSetData (JNIEnv *env, jclass obj, jlong handle, jlong data){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomTriMeshSetData");
#endif
	dGeomTriMeshSetData(geom(handle),trimeshdata(data));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomTriMeshGetData (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomTriMeshGetData");
#endif
	return (jlong)dGeomTriMeshGetData(geom(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomTriMeshEnableTC (JNIEnv *env, jclass obj, jlong handle, jint geomClass, jint enable){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomTriMeshEnableTC");
#endif
	dGeomTriMeshEnableTC(geom(handle),geomClass,enable);
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomTriMeshIsTCEnabled (JNIEnv *env, jclass obj, jlong handle, jint geomClass){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomTriMeshIsTCEnabled");
#endif
	return dGeomTriMeshIsTCEnabled(geom(handle),geomClass);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomTriMeshClearTCCache (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomTriMeshClearTCCache");
#endif
	dGeomTriMeshClearTCCache(geom(handle));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomTriMeshGetTriMeshDataID (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomTriMeshGetTriMeshDataID");
#endif
	return (jlong)dGeomTriMeshGetTriMeshDataID(geom(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomTriMeshGetTriangle (JNIEnv *env, jclass obj, jlong handle, jint index, jfloatArray V0, jfloatArray V1, jfloatArray V2){
	dVector4 v0;
	dVector4 v1;
	dVector4 v2;
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomTriMeshGetTriangle");
#endif
	dGeomTriMeshGetTriangle(geom(handle),index,&v0,&v1,&v2);

	env->SetFloatArrayRegion(V0,0,4,(float*)v0);
	env->SetFloatArrayRegion(V1,0,4,(float*)v1);
	env->SetFloatArrayRegion(V2,0,4,(float*)v2);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomTriMeshGetPoint (JNIEnv *env, jclass obj, jlong handle, jint index, jfloat u, jfloat v, jfloatArray Out){
	float out;
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomTriMeshGetPoint");
#endif
	dGeomTriMeshGetPoint(geom(handle),index,u,v,&out);
	env->SetFloatArrayRegion(Out,0,1,&out);
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomTriMeshGetTriangleCount (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomTriMeshGetTriangleCount");
#endif
	return dGeomTriMeshGetTriangleCount(geom(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGeomTriMeshDataUpdate (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGeomTriMeshDataUpdate");
#endif
	dGeomTriMeshDataUpdate(trimeshdata(handle));
}
// end of trimesh

JNIEXPORT jstring JNICALL Java_com_paranoidmonkey_ode_AndrODE_dGetConfiguration (JNIEnv *env , jclass obj){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dGetConfiguration");
#endif
	const char *str=dGetConfiguration();
	return env->NewStringUTF(str);
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dCheckConfiguration (JNIEnv *env , jclass obj, jstring chrArr){
	jboolean isCopy;
	const char *token=env->GetStringUTFChars(chrArr,&isCopy);

#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dCheckConfiguration");
#endif
	int ret=dCheckConfiguration(token);

	env->ReleaseStringUTFChars(chrArr, token);
	return ret;
}

// mass
JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dMassCheck (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dMassCheck");
#endif
	return dMassCheck(mass(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dMassSetZero (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dMassSetZero");
#endif
	dMassSetZero(mass(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dMassSetParameters (JNIEnv *env, jclass obj, jlong handle, jfloat themass, jfloat cgx, jfloat cgy, jfloat cgz, jfloat i11, jfloat i22, jfloat i33, jfloat i12, jfloat i13, jfloat i23){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dMassSetParameters");
#endif
	dMassSetParameters(mass(handle),themass,cgx,cgy,cgz,i11,i22,i33,i12,i13,123);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dMassSetSphere (JNIEnv *env, jclass obj, jlong handle, jfloat density, jfloat radius){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dMassSetSphere");
#endif
	dMassSetSphere(mass(handle),density,radius);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dMassSetSphereTotal (JNIEnv *env, jclass obj, jlong handle, jfloat total_mass, jfloat radius){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dMassSetSphereTotal");
#endif
	dMassSetSphereTotal(mass(handle),total_mass,radius);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dMassSetCapsule (JNIEnv *env, jclass obj, jlong handle, jfloat density, jint direction, jfloat radius, jfloat length){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dMassSetCapsule");
#endif
	dMassSetCapsule(mass(handle),density,direction,radius,length);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dMassSetCapsuleTotal (JNIEnv *env, jclass obj, jlong handle, jfloat total_mass, jint direction, jfloat radius, jfloat length){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dMassSetCapsuleTotal");
#endif
	dMassSetCapsuleTotal(mass(handle),total_mass,direction,radius,length);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dMassSetCylinder (JNIEnv *env, jclass obj, jlong handle, jfloat density, jint direction, jfloat radius, jfloat length){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dMassSetCylinder");
#endif
	dMassSetCylinder(mass(handle),density,direction,radius,length);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dMassSetCylinderTotal (JNIEnv *env, jclass obj, jlong handle, jfloat total_mass, jint direction, jfloat radius, jfloat length){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dMassSetCylinderTotal");
#endif
	dMassSetCylinderTotal(mass(handle),total_mass,direction,radius,length);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dMassSetBox (JNIEnv *env, jclass obj, jlong handle, jfloat density, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dMassSetBox");
#endif
	dMassSetBox(mass(handle),density,x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dMassSetBoxTotal (JNIEnv *env, jclass obj, jlong handle, jfloat total_mass, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dMassSetBoxTotal");
#endif
	dMassSetBoxTotal(mass(handle),total_mass,x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dMassSetTrimesh (JNIEnv *env, jclass obj, jlong handle, jfloat density, jlong handle2){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dMassSetTrimesh");
#endif
	dMassSetTrimesh(mass(handle),density,geom(handle2));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dMassSetTrimeshTotal (JNIEnv *env, jclass obj, jlong handle, jfloat density, jlong handle2){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dMassSetTrimeshTotal");
#endif
	dMassSetTrimeshTotal(mass(handle),density,geom(handle2));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dMassAdjust (JNIEnv *env, jclass obj, jlong handle, jfloat newMass){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dMassAdjust");
#endif
	dMassAdjust(mass(handle),newMass);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dMassTranslate (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dMassTranslate");
#endif
	dMassTranslate(mass(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dMassRotate (JNIEnv *env, jclass obj, jlong handle, jfloatArray R){
	float *r=toCArray(env,R);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dMassRotate");
#endif
	dMassRotate(mass(handle),r);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dMassAdd (JNIEnv *env, jclass obj, jlong handle, jlong handle2){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dMassAdd");
#endif
	dMassAdd(mass(handle),mass(handle2));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dMassCreate (JNIEnv *env, jclass obj){
	dMass *m=new dMass();
	return (jlong)m;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dMassDestroy (JNIEnv *env, jclass obj,jlong handle){
	dMass *m=mass(handle);
	delete m;
}

// end of mass


// start of world
JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldCreate (JNIEnv *env , jclass obj){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldCreate");
#endif
	return (jlong)dWorldCreate();
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldDestroy (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldDestroy");
#endif
	dWorldDestroy(world(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldSetGravity (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldSetGravity");
#endif
	dWorldSetGravity(world(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldGetGravity (JNIEnv *env, jclass obj, jlong handle, jfloatArray Grav){
	float *grav=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldGetGravity");
#endif
	dWorldGetGravity(world(handle),grav);
	env->SetFloatArrayRegion(Grav,0,3,grav);
	delete grav;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldSetERP (JNIEnv *env, jclass obj, jlong handle, jfloat erp){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldSetERP");
#endif
	dWorldSetERP(world(handle),erp);
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldGetERP (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldGetERP");
#endif
	return dWorldGetERP(world(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldSetCFM (JNIEnv *env, jclass obj, jlong handle, jfloat cfm){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldSetCFM");
#endif
	dWorldSetCFM(world(handle),cfm);
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldGetCFM (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldGetCFM");
#endif
	return dWorldGetCFM(world(handle));
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldUseSharedWorkingMemory (JNIEnv *env, jclass obj, jlong handle, jlong handle2){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldUseSharedWorkingMemory");
#endif
	return dWorldUseSharedWorkingMemory(world(handle),world(handle2));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldCleanupWorkingMemory (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldCleanupWorkingMemory");
#endif
	dWorldCleanupWorkingMemory(world(handle));
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldStep (JNIEnv *env, jclass obj, jlong handle, jfloat step){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldStep");
#endif
	return dWorldStep(world(handle),step);
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldQuickStep (JNIEnv *env, jclass obj, jlong handle, jfloat step){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldQuickStep");
#endif
	return dWorldQuickStep(world(handle),step);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldImpulseToForce (JNIEnv *env, jclass obj, jlong handle, jfloat step, jfloat x, jfloat y, jfloat z, jfloatArray Force){
	float *force=toCArray(env,Force);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldImpulseToForce");
#endif
	dWorldImpulseToForce(world(handle),step,x,y,z,force);
	delete force;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldSetQuickStepNumIterations (JNIEnv *env, jclass obj, jlong handle, jint num){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldSetQuickStepNumIterations");
#endif
	dWorldSetQuickStepNumIterations(world(handle),num);
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldGetQuickStepNumIterations (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldGetQuickStepNumIterations");
#endif
	return dWorldGetQuickStepNumIterations(world(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldSetQuickStepW (JNIEnv *env, jclass obj, jlong handle, jfloat w){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldSetQuickStepW");
#endif
	dWorldSetQuickStepW(world(handle),w);
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldGetQuickStepW (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldGetQuickStepW");
#endif
	return dWorldGetQuickStepW(world(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldSetContactMaxCorrectingVel (JNIEnv *env, jclass obj, jlong handle, jfloat vel){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldSetContactMaxCorrectingVel");
#endif
	dWorldSetContactMaxCorrectingVel(world(handle),vel);
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldGetContactMaxCorrectingVel (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldGetContactMaxCorrectingVel");
#endif
	return dWorldGetContactMaxCorrectingVel(world(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldSetContactSurfaceLayer (JNIEnv *env, jclass obj, jlong handle, jfloat depth){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldSetContactSurfaceLayer");
#endif
	dWorldSetContactSurfaceLayer(world(handle),depth);
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldGetContactSurfaceLayer (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldGetContactSurfaceLayer");
#endif
	return dWorldGetContactSurfaceLayer(world(handle));
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldGetAutoDisableLinearThreshold (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldGetAutoDisableLinearThreshold");
#endif
	return dWorldGetAutoDisableLinearThreshold(world(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldSetAutoDisableLinearThreshold (JNIEnv *env, jclass obj, jlong handle, jfloat t){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldSetAutoDisableLinearThreshold");
#endif
	dWorldSetAutoDisableLinearThreshold(world(handle),t);
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldGetAutoDisableAngularThreshold (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldGetAutoDisableAngularThreshold");
#endif
	return dWorldGetAutoDisableAngularThreshold(world(handle));
}

/*
 * commented out due to linker error
JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldSetAutoDisableAngularThreshold (JNIEnv *env, jclass obj, jlong handle, jfloat t){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldSetAutoDisableAngularThreshold");
#endif
	dWorldSetAutoDisableAngularThreshold(world(handle),t);
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldGetAutoDisableLinearAverageThreshold (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldGetAutoDisableLinearAverageThreshold");
#endif
	return dWorldGetAutoDisableLinearAverageThreshold(world(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldSetAutoDisableLinearAverageThreshold (JNIEnv *env, jclass obj, jlong handle, jfloat t){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldSetAutoDisableLinearAverageThreshold");
#endif
	dWorldSetAutoDisableLinearAverageThreshold(world(handle),t);
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldGetAutoDisableAngularAverageThreshold (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldGetAutoDisableAngularAverageThreshold");
#endif
	return dWorldGetAutoDisableAngularAverageThreshold(world(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldSetAutoDisableAngularAverageThreshold (JNIEnv *env, jclass obj, jlong handle, jfloat t){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldSetAutoDisableAngularAverageThreshold");
#endif
	dWorldSetAutoDisableAngularAverageThreshold(world(handle),t);
}
*/

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldGetAutoDisableAverageSamplesCount (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldGetAutoDisableAverageSamplesCount");
#endif
	return dWorldGetAutoDisableAverageSamplesCount(world(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldSetAutoDisableAverageSamplesCount (JNIEnv *env, jclass obj, jlong handle, jint c){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldSetAutoDisableAverageSamplesCount");
#endif
	dWorldSetAutoDisableAverageSamplesCount(world(handle),c);
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldGetAutoDisableSteps (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldGetAutoDisableSteps");
#endif
	return dWorldGetAutoDisableSteps(world(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldSetAutoDisableSteps (JNIEnv *env, jclass obj, jlong handle, jint s){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldSetAutoDisableSteps");
#endif
	dWorldSetAutoDisableSteps(world(handle),s);
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldGetAutoDisableTime (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldGetAutoDisableTime");
#endif
	return dWorldGetAutoDisableTime(world(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldSetAutoDisableTime (JNIEnv *env, jclass obj, jlong handle, jfloat t){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldSetAutoDisableTime");
#endif
	dWorldSetAutoDisableTime(world(handle),t);
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldGetAutoDisableFlag (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldGetAutoDisableFlag");
#endif
	return dWorldGetAutoDisableFlag(world(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldSetAutoDisableFlag (JNIEnv *env, jclass obj, jlong handle, jint f){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldSetAutoDisableFlag");
#endif
	dWorldSetAutoDisableFlag(world(handle),f);
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldGetLinearDampingThreshold (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldGetLinearDampingThreshold");
#endif
	return dWorldGetLinearDampingThreshold(world(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldSetLinearDampingThreshold (JNIEnv *env, jclass obj, jlong handle, jfloat t){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldSetLinearDampingThreshold");
#endif
	dWorldSetLinearDampingThreshold(world(handle),t);
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldGetAngularDampingThreshold (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldGetAngularDampingThreshold");
#endif
	return dWorldGetAngularDampingThreshold(world(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldSetAngularDampingThreshold (JNIEnv *env, jclass obj, jlong handle, jfloat t){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldSetAngularDampingThreshold");
#endif
	dWorldSetAngularDampingThreshold(world(handle),t);
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldGetLinearDamping (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldGetLinearDamping");
#endif
	return dWorldGetLinearDamping(world(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldSetLinearDamping (JNIEnv *env, jclass obj, jlong handle, jfloat d){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldSetLinearDamping");
#endif
	dWorldSetLinearDamping(world(handle),d);
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldGetAngularDamping (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldGetAngularDamping");
#endif
	return dWorldGetAngularDamping(world(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldSetAngularDamping (JNIEnv *env, jclass obj, jlong handle, jfloat d){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldSetAngularDamping");
#endif
	dWorldSetAngularDamping(world(handle),d);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldSetDamping (JNIEnv *env, jclass obj, jlong handle, jfloat ls, jfloat as){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldSetDamping");
#endif
	dWorldSetDamping(world(handle),ls,as);
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldGetMaxAngularSpeed (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldGetMaxAngularSpeed");
#endif
	return dWorldGetMaxAngularSpeed(world(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dWorldSetMaxAngularSpeed (JNIEnv *env, jclass obj, jlong handle, jfloat s){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dWorldSetMaxAngularSpeed");
#endif
	dWorldSetMaxAngularSpeed(world(handle),s);
}

// end of world

// start of body

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetAutoDisableLinearThreshold (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetAutoDisableLinearThreshold");
#endif
	return dBodyGetAutoDisableLinearThreshold(body(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodySetAutoDisableLinearThreshold (JNIEnv *env, jclass obj, jlong handle, jfloat t){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodySetAutoDisableLinearThreshold");
#endif
	dBodySetAutoDisableLinearThreshold(body(handle),t);
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetAutoDisableAngularThreshold (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetAutoDisableAngularThreshold");
#endif
	return dBodyGetAutoDisableAngularThreshold(body(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodySetAutoDisableAngularThreshold (JNIEnv *env, jclass obj, jlong handle, jfloat t){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodySetAutoDisableAngularThreshold");
#endif
	dBodySetAutoDisableAngularThreshold(body(handle),t);
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetAutoDisableAverageSamplesCount (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetAutoDisableAverageSamplesCount");
#endif
	return dBodyGetAutoDisableAverageSamplesCount(body(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodySetAutoDisableAverageSamplesCount (JNIEnv *env, jclass obj, jlong handle, jint c){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodySetAutoDisableAverageSamplesCount");
#endif
	dBodySetAutoDisableAverageSamplesCount(body(handle),c);
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetAutoDisableSteps (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetAutoDisableSteps");
#endif
	return dBodyGetAutoDisableSteps(body(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodySetAutoDisableSteps (JNIEnv *env, jclass obj, jlong handle, jint s){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodySetAutoDisableSteps");
#endif
	dBodySetAutoDisableSteps(body(handle),s);
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetAutoDisableTime (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetAutoDisableTime");
#endif
	return dBodyGetAutoDisableTime(body(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodySetAutoDisableTime (JNIEnv *env, jclass obj, jlong handle, jfloat t){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodySetAutoDisableTime");
#endif
	dBodySetAutoDisableTime(body(handle),t);
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetAutoDisableFlag (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetAutoDisableFlag");
#endif
	return dBodyGetAutoDisableFlag(body(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodySetAutoDisableFlag (JNIEnv *env, jclass obj, jlong handle, jint f){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodySetAutoDisableFlag");
#endif
	dBodySetAutoDisableFlag(body(handle),f);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodySetAutoDisableDefaults (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodySetAutoDisableDefaults");
#endif
	dBodySetAutoDisableDefaults(body(handle));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetWorld (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetWorld");
#endif
	return (jlong)dBodyGetWorld(body(handle));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyCreate (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyCreate");
#endif
	return (jlong)dBodyCreate(world(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyDestroy (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyDestroy");
#endif
	dBodyDestroy(body(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodySetData (JNIEnv *env, jclass obj, jlong handle, jobject data){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodySetData");
#endif
	dBodySetData(body(handle),data);
}

JNIEXPORT jobject JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetData (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetData");
#endif
	return (jobject)dBodyGetData(body(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodySetPosition (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodySetPosition");
#endif
	dBodySetPosition(body(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodySetRotation (JNIEnv *env, jclass obj, jlong handle, jfloatArray R){
	float *r=toCArray(env,R);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodySetRotation");
#endif
	dBodySetRotation(body(handle),r);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodySetQuaternion (JNIEnv *env, jclass obj, jlong handle, jfloatArray Q){
	float *q=toCArray(env,Q);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodySetQuaternion");
#endif
	dBodySetQuaternion(body(handle),q);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodySetLinearVel (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodySetLinearVel");
#endif
	dBodySetLinearVel(body(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodySetAngularVel (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodySetAngularVel");
#endif
	dBodySetAngularVel(body(handle),x,y,z);
}

JNIEXPORT jfloatArray JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetPosition (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetPosition");
#endif
	float *ret=(float*)dBodyGetPosition(body(handle));
	return fromCArray(env,ret,3);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyCopyPosition (JNIEnv *env, jclass obj, jlong handle, jfloatArray Pos){
	float *pos=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyCopyPosition");
#endif
	dBodyCopyPosition(body(handle),pos);
	env->SetFloatArrayRegion(Pos,0,3,pos);
	delete pos;
}

JNIEXPORT jfloatArray JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetRotation (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetRotation");
#endif
	float *data=(float*)dBodyGetRotation(body(handle));
	return fromCArray(env,data,12);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyCopyRotation (JNIEnv *env, jclass obj, jlong handle, jfloatArray R){
	float *r=new float[12];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyCopyRotation");
#endif
	dBodyCopyRotation(body(handle),r);
	env->SetFloatArrayRegion(R,0,12,r);
	delete r;
}

JNIEXPORT jfloatArray JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetQuaternion (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetQuaternion");
#endif
	float *data=(float*)dBodyGetQuaternion(body(handle));
	return fromCArray(env,data,4);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyCopyQuaternion (JNIEnv *env, jclass obj, jlong handle, jfloatArray Quat){
	float *quat=new float[4];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyCopyQuaternion");
#endif
	dBodyCopyQuaternion(body(handle),quat);
	env->SetFloatArrayRegion(Quat,0,4,quat);
	delete quat;

}

JNIEXPORT jfloatArray JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetLinearVel (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetLinearVel");
#endif
	float *ret=(float*)dBodyGetLinearVel(body(handle));
	return fromCArray(env,ret,3);
}

JNIEXPORT jfloatArray JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetAngularVel (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetAngularVel");
#endif
	float *ret=(float*)dBodyGetAngularVel(body(handle));
	return fromCArray(env,ret,3);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodySetMass (JNIEnv *env, jclass obj, jlong handle, jlong handle2){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodySetMass");
#endif
	dBodySetMass(body(handle),mass(handle2));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetMass (JNIEnv *env, jclass obj, jlong handle, jlong handle2){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetMass");
#endif
	dBodyGetMass(body(handle),mass(handle2));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyAddForce (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyAddForce");
#endif
	dBodyAddForce(body(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyAddTorque (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyAddTorque");
#endif
	dBodyAddTorque(body(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyAddRelForce (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyAddRelForce");
#endif
	dBodyAddRelForce(body(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyAddRelTorque (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyAddRelTorque");
#endif
	dBodyAddRelTorque(body(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyAddForceAtPos (JNIEnv *env, jclass obj, jlong handle, jfloat fx, jfloat fy, jfloat fz, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyAddForceAtPos");
#endif
	dBodyAddForceAtPos(body(handle),fx,fy,fz,x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyAddForceAtRelPos (JNIEnv *env, jclass obj, jlong handle, jfloat fx, jfloat fy, jfloat fz, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyAddForceAtRelPos");
#endif
	dBodyAddForceAtRelPos(body(handle),fx,fy,fz,x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyAddRelForceAtPos (JNIEnv *env, jclass obj, jlong handle, jfloat fx, jfloat fy, jfloat fz, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyAddRelForceAtPos");
#endif
	dBodyAddRelForceAtPos(body(handle),fx,fy,fz,x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyAddRelForceAtRelPos (JNIEnv *env, jclass obj, jlong handle, jfloat fx, jfloat fy, jfloat fz, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyAddRelForceAtRelPos");
#endif
	dBodyAddRelForceAtRelPos(body(handle),fx,fy,fz,x,y,z);
}

JNIEXPORT jfloatArray JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetForce (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetForce");
#endif
	float *arr=(float*)dBodyGetForce(body(handle));
	return fromCArray(env,arr,3);
}

JNIEXPORT jfloatArray JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetTorque (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetTorque");
#endif
	float *arr=(float*)dBodyGetTorque(body(handle));
	return fromCArray(env,arr,3);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodySetForce (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodySetForce");
#endif
	dBodySetForce(body(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodySetTorque (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodySetTorque");
#endif
	dBodySetTorque(body(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetRelPointPos (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z, jfloatArray arr){
	float *ret=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetRelPointPos");
#endif
	dBodyGetRelPointPos(body(handle),x,y,z,ret);
	env->SetFloatArrayRegion(arr,0,3,ret);
	delete ret;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetRelPointVel (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z, jfloatArray arr){
	float *ret=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetRelPointVel");
#endif
	dBodyGetRelPointVel(body(handle),x,y,z,ret);
	env->SetFloatArrayRegion(arr,0,3,ret);
	delete ret;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetPointVel (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z, jfloatArray arr){
	float *ret=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetRelPointVel");
#endif
	dBodyGetRelPointVel(body(handle),x,y,z,ret);
	env->SetFloatArrayRegion(arr,0,3,ret);
	delete ret;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetPosRelPoint (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z, jfloatArray arr){
	float *ret=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetPosRelPoint");
#endif
	dBodyGetPosRelPoint(body(handle),x,y,z,ret);
	env->SetFloatArrayRegion(arr,0,3,ret);
	delete ret;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyVectorToWorld (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z, jfloatArray arr){
	float *ret=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyVectorToWorld");
#endif
	dBodyVectorToWorld(body(handle),x,y,z,ret);
	env->SetFloatArrayRegion(arr,0,3,ret);
	delete ret;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyVectorFromWorld (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z, jfloatArray arr){
	float *ret=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyVectorFromWorld");
#endif
	dBodyVectorFromWorld(body(handle),x,y,z,ret);
	env->SetFloatArrayRegion(arr,0,3,ret);
	delete ret;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodySetFiniteRotationMode (JNIEnv *env, jclass obj, jlong handle, jint mode){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodySetFiniteRotationMode");
#endif
	dBodySetFiniteRotationMode(body(handle),mode);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodySetFiniteRotationAxis (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodySetFiniteRotationAxis");
#endif
	dBodySetFiniteRotationAxis(body(handle),x,y,z);
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetFiniteRotationMode (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetFiniteRotationMode");
#endif
	return dBodyGetFiniteRotationMode(body(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetFiniteRotationAxis (JNIEnv *env, jclass obj, jlong handle, jfloatArray arr){
	float *ret=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetFiniteRotationAxis");
#endif
	dBodyGetFiniteRotationAxis(body(handle),ret);
	env->SetFloatArrayRegion(arr,0,3,ret);
	delete ret;
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetNumJoints (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetNumJoints");
#endif
	return dBodyGetNumJoints(body(handle));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetJoint (JNIEnv *env, jclass obj, jlong handle, jint i){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetJoint");
#endif
	return (jlong)dBodyGetJoint(body(handle),i);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodySetDynamic (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodySetDynamic");
#endif
	dBodySetDynamic(body(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodySetKinematic (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodySetKinematic");
#endif
	dBodySetKinematic(body(handle));
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyIsKinematic (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyIsKinematic");
#endif
	return dBodyIsKinematic(body(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyEnable (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyEnable");
#endif
	dBodyEnable(body(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyDisable (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyDisable");
#endif
	dBodyDisable(body(handle));
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyIsEnabled (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyIsEnabled");
#endif
	return dBodyIsEnabled(body(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodySetGravityMode (JNIEnv *env, jclass obj, jlong handle, jint mode){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodySetGravityMode");
#endif
	dBodySetGravityMode(body(handle),mode);
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetGravityMode (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetGravityMode");
#endif
	return dBodyGetGravityMode(body(handle));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetFirstGeom (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetFirstGeom");
#endif
	return (jlong)dBodyGetFirstGeom(body(handle));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetNextGeom (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetNextGeom");
#endif
	return (jlong)dBodyGetNextGeom(geom(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodySetDampingDefaults (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodySetDampingDefaults");
#endif
	dBodySetDampingDefaults(body(handle));
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetLinearDamping (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetLinearDamping");
#endif
	return dBodyGetLinearDamping(body(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodySetLinearDamping (JNIEnv *env, jclass obj, jlong handle, jfloat s){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodySetLinearDamping");
#endif
	dBodySetLinearDamping(body(handle),s);
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetAngularDamping (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetAngularDamping");
#endif
	return dBodyGetAngularDamping(body(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodySetAngularDamping (JNIEnv *env, jclass obj, jlong handle, jfloat s){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodySetAngularDamping");
#endif
	dBodySetAngularDamping(body(handle),s);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodySetDamping (JNIEnv *env, jclass obj, jlong handle, jfloat ls, jfloat as){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodySetDamping");
#endif
	dBodySetDamping(body(handle),ls,as);
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetLinearDampingThreshold (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetLinearDampingThreshold");
#endif
	return dBodyGetLinearDampingThreshold(body(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodySetLinearDampingThreshold (JNIEnv *env, jclass obj, jlong handle, jfloat t){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodySetLinearDampingThreshold");
#endif
	dBodySetLinearDampingThreshold(body(handle),t);
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetAngularDampingThreshold (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetAngularDampingThreshold");
#endif
	return dBodyGetAngularDampingThreshold(body(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodySetAngularDampingThreshold (JNIEnv *env, jclass obj, jlong handle, jfloat t){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodySetAngularDampingThreshold");
#endif
	dBodySetAngularDampingThreshold(body(handle),t);
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetMaxAngularSpeed (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetMaxAngularSpeed");
#endif
	return dBodyGetMaxAngularSpeed(body(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodySetMaxAngularSpeed (JNIEnv *env, jclass obj, jlong handle, jfloat s){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodySetMaxAngularSpeed");
#endif
	dBodySetMaxAngularSpeed(body(handle),s);
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodyGetGyroscopicMode (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodyGetGyroscopicMode");
#endif
	return dBodyGetGyroscopicMode(body(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dBodySetGyroscopicMode (JNIEnv *env, jclass obj, jlong handle, jint m){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dBodySetGyroscopicMode");
#endif
	dBodySetGyroscopicMode(body(handle),m);
}

// end of body

// start of joint

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointCreateBall (JNIEnv *env, jclass obj, jlong handle, jlong handle2){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointCreateBall");
#endif
	return (jlong)dJointCreateBall(world(handle),jointgroup(handle2));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointCreateHinge (JNIEnv *env, jclass obj, jlong handle, jlong handle2){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointCreateHinge");
#endif
	return (jlong)dJointCreateHinge(world(handle),jointgroup(handle2));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointCreateSlider (JNIEnv *env, jclass obj, jlong handle, jlong handle2){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointCreateSlider");
#endif
	return (jlong)dJointCreateSlider(world(handle),jointgroup(handle2));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointCreateContact (JNIEnv *env, jclass obj, jlong handle, jlong handle2, jlong contact){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointCreateContact");
#endif
	return (jlong)dJointCreateContact(world(handle),jointgroup(handle2),(dContact*)contact);
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointCreateHinge2 (JNIEnv *env, jclass obj, jlong handle, jlong handle2){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointCreateHinge2");
#endif
	return (jlong)dJointCreateHinge2(world(handle),jointgroup(handle2));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointCreateUniversal (JNIEnv *env, jclass obj, jlong handle, jlong handle2){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointCreateUniversal");
#endif
	return (jlong)dJointCreateUniversal(world(handle),jointgroup(handle2));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointCreatePR (JNIEnv *env, jclass obj, jlong handle, jlong handle2){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointCreatePR");
#endif
	return (jlong)dJointCreatePR(world(handle),jointgroup(handle2));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointCreatePU (JNIEnv *env, jclass obj, jlong handle, jlong handle2){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointCreatePU");
#endif
	return (jlong)dJointCreatePU(world(handle),jointgroup(handle2));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointCreatePiston (JNIEnv *env, jclass obj, jlong handle, jlong handle2){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointCreatePiston");
#endif
	return (jlong)dJointCreatePiston(world(handle),jointgroup(handle2));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointCreateFixed (JNIEnv *env, jclass obj, jlong handle, jlong handle2){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointCreateFixed");
#endif
	return (jlong)dJointCreateFixed(world(handle),jointgroup(handle2));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointCreateNull (JNIEnv *env, jclass obj, jlong handle, jlong handle2){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointCreateNull");
#endif
	return (jlong)dJointCreateNull(world(handle),jointgroup(handle2));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointCreateAMotor (JNIEnv *env, jclass obj, jlong handle, jlong handle2){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointCreateAMotor");
#endif
	return (jlong)dJointCreateAMotor(world(handle),jointgroup(handle2));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointCreateLMotor (JNIEnv *env, jclass obj, jlong handle, jlong handle2){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointCreateLMotor");
#endif
	return (jlong)dJointCreateLMotor(world(handle),jointgroup(handle2));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointCreatePlane2D (JNIEnv *env, jclass obj, jlong handle, jlong handle2){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointCreatePlane2D");
#endif
	return (jlong)dJointCreatePlane2D(world(handle),jointgroup(handle2));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointDestroy (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointDestroy");
#endif
	dJointDestroy(joint(handle));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGroupCreate (JNIEnv *env , jclass obj, jint maxsize){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGroupCreate");
#endif
	return (jlong)dJointGroupCreate(maxsize);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGroupDestroy (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGroupDestroy");
#endif
	dJointGroupDestroy(jointgroup(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGroupEmpty (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGroupEmpty");
#endif
	dJointGroupEmpty(jointgroup(handle));
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetNumBodies (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetNumBodies");
#endif
	return dJointGetNumBodies(joint(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointAttach (JNIEnv *env, jclass obj, jlong handle, jlong handle2, jlong handle3){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointEnable");
#endif
	dJointAttach(joint(handle),body(handle2),body(handle3));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointEnable (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointEnable");
#endif
	dJointEnable(joint(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointDisable (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointDisable");
#endif
	dJointDisable(joint(handle));
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointIsEnabled (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointIsEnabled");
#endif
	return dJointIsEnabled(joint(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetData (JNIEnv *env, jclass obj, jlong handle, jobject data){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetData");
#endif
	dJointSetData(joint(handle),data);
}

JNIEXPORT jobject JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetData (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetData");
#endif
	return (jobject)dJointGetData(joint(handle));
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetType (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetType");
#endif
	return dJointGetType(joint(handle));
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetBody (JNIEnv *env, jclass obj, jlong handle, jint i){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetBody");
#endif
	return (jlong)dJointGetBody(joint(handle),i);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetFeedback (JNIEnv *env, jclass obj, jlong handle, jlong feedback){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetFeedback");
#endif
	dJointSetFeedback(joint(handle),(dJointFeedback*)feedback);
}
JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetFeedback (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetFeedback");
#endif
	return (jlong)dJointGetFeedback(joint(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetBallAnchor (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetBallAnchor");
#endif
	dJointSetBallAnchor(joint(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetBallAnchor2 (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetBallAnchor2");
#endif
	dJointSetBallAnchor2(joint(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetBallParam (JNIEnv *env, jclass obj, jlong handle, jint p, jfloat v){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetBallParam");
#endif
	dJointSetBallParam(joint(handle),p,v);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetHingeAnchor (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetHingeAnchor");
#endif
	dJointSetHingeAnchor(joint(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetHingeAnchorDelta (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z, jfloat ax, jfloat ay, jfloat az){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetHingeAnchorDelta");
#endif
	dJointSetHingeAnchorDelta(joint(handle),x,y,z,ax,ay,az);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetHingeAxis (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetHingeAxis");
#endif
	dJointSetHingeAxis(joint(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetHingeAxisOffset (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z, jfloat a){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetHingeAxisOffset");
#endif
	dJointSetHingeAxisOffset(joint(handle),x,y,z,a);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetHingeParam (JNIEnv *env, jclass obj, jlong handle, jint p, jfloat v){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetHingeParam");
#endif
	dJointSetHingeParam(joint(handle),p,v);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointAddHingeTorque (JNIEnv *env, jclass obj, jlong handle, jfloat t){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointAddHingeTorque");
#endif
	dJointAddHingeTorque(joint(handle),t);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetSliderAxis (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetSliderAxis");
#endif
	dJointSetSliderAxis(joint(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetSliderAxisDelta (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z, jfloat ax, jfloat ay, jfloat az){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetSliderAxisDelta");
#endif
	dJointSetSliderAxisDelta(joint(handle),x,y,z,ax,ay,az);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetSliderParam (JNIEnv *env, jclass obj, jlong handle, jint p, jfloat v){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetSliderParam");
#endif
	dJointSetSliderParam(joint(handle),p,v);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointAddSliderForce (JNIEnv *env, jclass obj, jlong handle, jfloat f){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointAddSliderForce");
#endif
	dJointAddSliderForce(joint(handle),f);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetHinge2Anchor (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetHinge2Anchor");
#endif
	dJointSetHinge2Anchor(joint(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetHinge2Axis1 (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetHinge2Axis1");
#endif
	dJointSetHinge2Axis1(joint(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetHinge2Axis2 (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetHinge2Axis2");
#endif
	dJointSetHinge2Axis2(joint(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetHinge2Param (JNIEnv *env, jclass obj, jlong handle, jint p, jfloat v){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetHinge2Param");
#endif
	dJointSetHinge2Param(joint(handle),p,v);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointAddHinge2Torques (JNIEnv *env, jclass obj, jlong handle, jfloat t1, jfloat t2){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointAddHinge2Torques");
#endif
	dJointAddHinge2Torques(joint(handle),t1,t2);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetUniversalAnchor (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetUniversalAnchor");
#endif
	dJointSetUniversalAnchor(joint(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetUniversalAxis1 (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetUniversalAxis1");
#endif
	dJointSetUniversalAxis1(joint(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetUniversalAxis1Offset (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z, jfloat o1, jfloat o2){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetUniversalAxis1Offset");
#endif
	dJointSetUniversalAxis1Offset(joint(handle),x,y,z,o1,o2);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetUniversalAxis2 (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetUniversalAxis2");
#endif
	dJointSetUniversalAxis2(joint(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetUniversalAxis2Offset (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z, jfloat o1, jfloat o2){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetUniversalAxis2Offset");
#endif
	dJointSetUniversalAxis2Offset(joint(handle),x,y,z,o1,o2);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetUniversalParam (JNIEnv *env, jclass obj, jlong handle, jint p, jfloat v){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetUniversalParam");
#endif
	dJointSetUniversalParam(joint(handle),p,v);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointAddUniversalTorques (JNIEnv *env, jclass obj, jlong handle, jfloat t1, jfloat t2){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointAddUniversalTorques");
#endif
	dJointAddUniversalTorques(joint(handle),t1,t2);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetPRAnchor (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetPRAnchor");
#endif
	dJointSetPRAnchor(joint(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetPRAxis1 (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetPRAxis1");
#endif
	dJointSetPRAxis1(joint(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetPRAxis2 (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetPRAxis2");
#endif
	dJointSetPRAxis2(joint(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetPRParam (JNIEnv *env, jclass obj, jlong handle, jint p, jfloat v){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetPRParam");
#endif
	dJointSetPRParam(joint(handle),p,v);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointAddPRTorque (JNIEnv *env, jclass obj, jlong handle, jfloat t){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointAddPRTorque");
#endif
	dJointAddPRTorque(joint(handle),t);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetPUAnchor (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetPUAnchor");
#endif
	dJointSetPUAnchor(joint(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetPUAnchorOffset (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z, jfloat ax, jfloat ay, jfloat az){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetPUAnchorOffset");
#endif
	dJointSetPUAnchorOffset(joint(handle),x,y,z,ax,ay,az);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetPUAxis1 (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetPUAxis1");
#endif
	dJointSetPUAxis1(joint(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetPUAxis2 (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetPUAxis2");
#endif
	dJointSetPUAxis2(joint(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetPUAxis3 (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetPUAxis3");
#endif
	dJointSetPUAxis3(joint(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetPUAxisP (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetPUAxisP");
#endif
	dJointSetPUAxisP(joint(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetPUParam (JNIEnv *env, jclass obj, jlong handle, jint p, jfloat v){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetPUParam");
#endif
	dJointSetPUParam(joint(handle),p,v);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetPistonAnchor (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetPistonAnchor");
#endif
	dJointSetPistonAnchor(joint(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetPistonAnchorOffset (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z, jfloat ax, jfloat ay, jfloat az){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetPistonAnchorOffset");
#endif
	dJointSetPistonAnchorOffset(joint(handle),x,y,z,ax,ay,az);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetPistonAxis (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetPistonAxis");
#endif
	dJointSetPistonAxis(joint(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetPistonParam (JNIEnv *env, jclass obj, jlong handle, jint p, jfloat v){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetPistonParam");
#endif
	dJointSetPistonParam(joint(handle),p,v);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointAddPistonForce (JNIEnv *env, jclass obj, jlong handle, jfloat f){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointAddPistonForce");
#endif
	dJointAddPistonForce(joint(handle),f);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetFixed (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetFixed");
#endif
	dJointSetFixed(joint(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetFixedParam (JNIEnv *env, jclass obj, jlong handle, jint p, jfloat v){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetFixedParam");
#endif
	dJointSetFixedParam(joint(handle),p,v);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetAMotorNumAxes (JNIEnv *env, jclass obj, jlong handle, jint n){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetAMotorNumAxes");
#endif
	dJointSetAMotorNumAxes(joint(handle),n);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetAMotorAxis  (JNIEnv *env, jclass obj, jlong handle, jint anum, jint rel, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetAMotorAxis");
#endif
	dJointSetAMotorAxis(joint(handle),anum,rel,x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetAMotorAngle (JNIEnv *env, jclass obj, jlong handle, jint p, jfloat v){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetAMotorAngle");
#endif
	dJointSetAMotorAngle(joint(handle),p,v);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetAMotorParam (JNIEnv *env, jclass obj, jlong handle, jint p, jfloat v){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetAMotorParam");
#endif
	dJointSetAMotorParam(joint(handle),p,v);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetAMotorMode (JNIEnv *env, jclass obj, jlong handle, jint m){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetAMotorMode");
#endif
	dJointSetAMotorMode(joint(handle),m);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointAddAMotorTorques (JNIEnv *env, jclass obj, jlong handle, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointAddAMotorTorques");
#endif
	dJointAddAMotorTorques(joint(handle),x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetLMotorNumAxes (JNIEnv *env, jclass obj, jlong handle, jint n){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetLMotorNumAxes");
#endif
	dJointSetLMotorNumAxes(joint(handle),n);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetLMotorAxis (JNIEnv *env, jclass obj, jlong handle, jint a, jint r, jfloat x, jfloat y, jfloat z){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetLMotorAxis");
#endif
	dJointSetLMotorAxis(joint(handle),a,r,x,y,z);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetLMotorParam (JNIEnv *env, jclass obj, jlong handle, jint p, jfloat v){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetLMotorParam");
#endif
	dJointSetLMotorParam(joint(handle),p,v);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetPlane2DXParam (JNIEnv *env, jclass obj, jlong handle, jint p, jfloat v){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetPlane2DXParam");
#endif
	dJointSetPlane2DXParam(joint(handle),p,v);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetPlane2DYParam (JNIEnv *env, jclass obj, jlong handle, jint p, jfloat v){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetPlane2DYParam");
#endif
	dJointSetPlane2DYParam(joint(handle),p,v);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointSetPlane2DAngleParam (JNIEnv *env, jclass obj, jlong handle, jint p, jfloat v){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointSetPlane2DAngleParam");
#endif
	dJointSetPlane2DAngleParam(joint(handle),p,v);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetBallAnchor (JNIEnv *env, jclass obj, jlong handle, jfloatArray arr){
	float *res=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetBallAnchor");
#endif
	dJointGetBallAnchor(joint(handle),res);
	env->SetFloatArrayRegion(arr,0,3,res);
	delete res;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetBallAnchor2 (JNIEnv *env, jclass obj, jlong handle, jfloatArray arr){
	float *res=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetBallAnchor2");
#endif
	dJointGetBallAnchor2(joint(handle),res);
	env->SetFloatArrayRegion(arr,0,3,res);
	delete res;
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetBallParam (JNIEnv *env, jclass obj, jlong handle, jint p){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetBallParam");
#endif
	return dJointGetBallParam(joint(handle),p);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetHingeAnchor (JNIEnv *env, jclass obj, jlong handle, jfloatArray arr){
	float *res=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetHingeAnchor");
#endif
	dJointGetHingeAnchor(joint(handle),res);
	env->SetFloatArrayRegion(arr,0,3,res);
	delete res;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetHingeAnchor2 (JNIEnv *env, jclass obj, jlong handle, jfloatArray arr){
	float *res=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetHingeAnchor2");
#endif
	dJointGetHingeAnchor2(joint(handle),res);
	env->SetFloatArrayRegion(arr,0,3,res);
	delete res;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetHingeAxis (JNIEnv *env, jclass obj, jlong handle, jfloatArray arr){
	float *res=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetHingeAxis");
#endif
	dJointGetHingeAxis(joint(handle),res);
	env->SetFloatArrayRegion(arr,0,3,res);
	delete res;
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetHingeParam (JNIEnv *env, jclass obj, jlong handle, jint p){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetHingeParam");
#endif
	return dJointGetHingeParam(joint(handle),p);
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetHingeAngle (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetHingeAngle");
#endif
	return dJointGetHingeAngle(joint(handle));
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetHingeAngleRate (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetHingeAngleRate");
#endif
	return dJointGetHingeAngleRate(joint(handle));
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetSliderPosition (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetSliderPosition");
#endif
	return dJointGetSliderPosition(joint(handle));
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetSliderPositionRate (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetSliderPositionRate");
#endif
	return dJointGetSliderPositionRate(joint(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetSliderAxis (JNIEnv *env, jclass obj, jlong handle, jfloatArray arr){
	float *res=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetSliderAxis");
#endif
	dJointGetSliderAxis(joint(handle),res);
	env->SetFloatArrayRegion(arr,0,3,res);
	delete res;
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetSliderParam (JNIEnv *env, jclass obj, jlong handle, jint p){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetSliderParam");
#endif
	return dJointGetSliderParam(joint(handle),p);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetHinge2Anchor (JNIEnv *env, jclass obj, jlong handle, jfloatArray arr){
	float *res=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetHinge2Anchor");
#endif
	dJointGetHinge2Anchor(joint(handle),res);
	env->SetFloatArrayRegion(arr,0,3,res);
	delete res;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetHinge2Anchor2 (JNIEnv *env, jclass obj, jlong handle, jfloatArray arr){
	float *res=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetHinge2Anchor2");
#endif
	dJointGetHinge2Anchor2(joint(handle),res);
	env->SetFloatArrayRegion(arr,0,3,res);
	delete res;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetHinge2Axis1 (JNIEnv *env, jclass obj, jlong handle, jfloatArray arr){
	float *res=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetHinge2Axis1");
#endif
	dJointGetHinge2Axis1(joint(handle),res);
	env->SetFloatArrayRegion(arr,0,3,res);
	delete res;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetHinge2Axis2 (JNIEnv *env, jclass obj, jlong handle, jfloatArray arr){
	float *res=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetHinge2Axis2");
#endif
	dJointGetHinge2Axis2(joint(handle),res);
	env->SetFloatArrayRegion(arr,0,3,res);
	delete res;
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetHinge2Param (JNIEnv *env, jclass obj, jlong handle, jint p){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetHinge2Param");
#endif
	return dJointGetHinge2Param(joint(handle),p);
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetHinge2Angle1 (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetHinge2Angle1");
#endif
	return dJointGetHinge2Angle1(joint(handle));
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetHinge2Angle1Rate (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetHinge2Angle1Rate");
#endif
	return dJointGetHinge2Angle1Rate(joint(handle));
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetHinge2Angle2Rate (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetHinge2Angle2Rate");
#endif
	return dJointGetHinge2Angle2Rate(joint(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetUniversalAnchor (JNIEnv *env, jclass obj, jlong handle, jfloatArray arr){
	float *res=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetUniversalAnchor");
#endif
	dJointGetUniversalAnchor(joint(handle),res);
	env->SetFloatArrayRegion(arr,0,3,res);
	delete res;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetUniversalAnchor2 (JNIEnv *env, jclass obj, jlong handle, jfloatArray arr){
	float *res=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetUniversalAnchor2");
#endif
	dJointGetUniversalAnchor2(joint(handle),res);
	env->SetFloatArrayRegion(arr,0,3,res);
	delete res;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetUniversalAxis1 (JNIEnv *env, jclass obj, jlong handle, jfloatArray arr){
	float *res=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetUniversalAxis1");
#endif
	dJointGetUniversalAxis1(joint(handle),res);
	env->SetFloatArrayRegion(arr,0,3,res);
	delete res;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetUniversalAxis2 (JNIEnv *env, jclass obj, jlong handle, jfloatArray arr){
	float *res=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetUniversalAxis2");
#endif
	dJointGetUniversalAxis2(joint(handle),res);
	env->SetFloatArrayRegion(arr,0,3,res);
	delete res;
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetUniversalParam (JNIEnv *env, jclass obj, jlong handle, jint p){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetUniversalParam");
#endif
	return dJointGetUniversalParam(joint(handle),p);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetUniversalAngles (JNIEnv *env, jclass obj, jlong handle, jfloatArray arr1, jfloatArray arr2){
	float res,res2;
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetUniversalAngles");
#endif
	dJointGetUniversalAngles(joint(handle),&res,&res2);
	env->SetFloatArrayRegion(arr1,0,1,&res);
	env->SetFloatArrayRegion(arr2,0,1,&res2);
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetUniversalAngle1 (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetUniversalAngle1");
#endif
	return dJointGetUniversalAngle1(joint(handle));
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetUniversalAngle2 (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetUniversalAngle2");
#endif
	return dJointGetUniversalAngle2(joint(handle));
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetUniversalAngle1Rate (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetUniversalAngle1Rate");
#endif
	return dJointGetUniversalAngle1Rate(joint(handle));
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetUniversalAngle2Rate (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetUniversalAngle2Rate");
#endif
	return dJointGetUniversalAngle2Rate(joint(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetPRAnchor (JNIEnv *env, jclass obj, jlong handle, jfloatArray arr){
	float *res=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetPRAnchor");
#endif
	dJointGetPRAnchor(joint(handle),res);
	env->SetFloatArrayRegion(arr,0,3,res);
	delete res;
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetPRPosition (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetPRPosition");
#endif
	return dJointGetPRPosition(joint(handle));
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetPRPositionRate (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetPRPositionRate");
#endif
	return dJointGetPRPositionRate(joint(handle));
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetPRAngle (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetPRAngle");
#endif
	return dJointGetPRAngle(joint(handle));
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetPRAngleRate (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetPRAngleRate");
#endif
	return dJointGetPRAngleRate(joint(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetPRAxis1 (JNIEnv *env, jclass obj, jlong handle, jfloatArray arr){
	float *res=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetPRAxis1");
#endif
	dJointGetPRAxis1(joint(handle),res);
	env->SetFloatArrayRegion(arr,0,3,res);
	delete res;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetPRAxis2 (JNIEnv *env, jclass obj, jlong handle, jfloatArray arr){
	float *res=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetPRAxis2");
#endif
	dJointGetPRAxis2(joint(handle),res);
	env->SetFloatArrayRegion(arr,0,3,res);
	delete res;
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetPRParam (JNIEnv *env, jclass obj, jlong handle, jint p){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetPRParam");
#endif
	return dJointGetPRParam(joint(handle),p);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetPUAnchor (JNIEnv *env, jclass obj, jlong handle, jfloatArray arr){
	float *res=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetPUAnchor");
#endif
	dJointGetPUAnchor(joint(handle),res);
	env->SetFloatArrayRegion(arr,0,3,res);
	delete res;
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetPUPosition (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetPUPosition");
#endif
	return dJointGetPUPosition(joint(handle));
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetPUPositionRate (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetPUPositionRate");
#endif
	return dJointGetPUPositionRate(joint(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetPUAxis1 (JNIEnv *env, jclass obj, jlong handle, jfloatArray arr){
	float *res=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetPUAxis1");
#endif
	dJointGetPUAxis1(joint(handle),res);
	env->SetFloatArrayRegion(arr,0,3,res);
	delete res;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetPUAxis2 (JNIEnv *env, jclass obj, jlong handle, jfloatArray arr){
	float *res=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetPUAxis2");
#endif
	dJointGetPUAxis2(joint(handle),res);
	env->SetFloatArrayRegion(arr,0,3,res);
	delete res;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetPUAxis3 (JNIEnv *env, jclass obj, jlong handle, jfloatArray arr){
	float *res=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetPUAxis3");
#endif
	dJointGetPUAxis3(joint(handle),res);
	env->SetFloatArrayRegion(arr,0,3,res);
	delete res;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetPUAxisP (JNIEnv *env, jclass obj, jlong handle, jfloatArray arr){
	float *res=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetPUAxisP");
#endif
	dJointGetPUAxisP(joint(handle),res);
	env->SetFloatArrayRegion(arr,0,3,res);
	delete res;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetPUAngles (JNIEnv *env, jclass obj, jlong handle, jfloatArray arr1, jfloatArray arr2){
	float res,res2;
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetPUAngles");
#endif
	dJointGetPUAngles(joint(handle),&res,&res2);
	env->SetFloatArrayRegion(arr1,0,1,&res);
	env->SetFloatArrayRegion(arr2,0,1,&res2);
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetPUAngle1 (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetPUAngle1");
#endif
	return dJointGetPUAngle1(joint(handle));
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetPUAngle1Rate (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetPUAngle1Rate");
#endif
	return dJointGetPUAngle1Rate(joint(handle));
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetPUAngle2 (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetPUAngle2");
#endif
	return dJointGetPUAngle2(joint(handle));
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetPUAngle2Rate (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetPUAngle2Rate");
#endif
	return dJointGetPUAngle2Rate(joint(handle));
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetPUParam (JNIEnv *env, jclass obj, jlong handle, jint p){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetPUParam");
#endif
	return dJointGetPUParam(joint(handle),p);
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetPistonPosition (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetPistonPosition");
#endif
	return dJointGetPistonPosition(joint(handle));
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetPistonPositionRate (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetPistonPositionRate");
#endif
	return dJointGetPistonPositionRate(joint(handle));
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetPistonAngle (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetPistonAngle");
#endif
	return dJointGetPistonAngle(joint(handle));
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetPistonAngleRate (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetPistonAngleRate");
#endif
	return dJointGetPistonAngleRate(joint(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetPistonAnchor (JNIEnv *env, jclass obj, jlong handle, jfloatArray arr){
	float *res=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetPistonAnchor");
#endif
	dJointGetPistonAnchor(joint(handle),res);
	env->SetFloatArrayRegion(arr,0,3,res);
	delete res;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetPistonAnchor2 (JNIEnv *env, jclass obj, jlong handle, jfloatArray arr){
	float *res=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetPistonAnchor2");
#endif
	dJointGetPistonAnchor2(joint(handle),res);
	env->SetFloatArrayRegion(arr,0,3,res);
	delete res;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetPistonAxis (JNIEnv *env, jclass obj, jlong handle, jfloatArray arr){
	float *res=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetPistonAxis");
#endif
	dJointGetPistonAxis(joint(handle),res);
	env->SetFloatArrayRegion(arr,0,3,res);
	delete res;
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetPistonParam (JNIEnv *env, jclass obj, jlong handle, jint p){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetPistonParam");
#endif
	return dJointGetPistonParam(joint(handle),p);
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetAMotorNumAxes (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetAMotorNumAxes");
#endif
	return dJointGetAMotorNumAxes(joint(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetAMotorAxis (JNIEnv *env, jclass obj, jlong handle, jint a, jfloatArray arr){
	float *res=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetAMotorAxis");
#endif
	dJointGetAMotorAxis(joint(handle),a,res);
	env->SetFloatArrayRegion(arr,0,3,res);
	delete res;
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetAMotorAxisRel (JNIEnv *env, jclass obj, jlong handle, jint p){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetAMotorAxisRel");
#endif
	return dJointGetAMotorAxisRel(joint(handle),p);
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetAMotorAngle (JNIEnv *env, jclass obj, jlong handle, jint p){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetAMotorAngle");
#endif
	return dJointGetAMotorAngle(joint(handle),p);
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetAMotorAngleRate (JNIEnv *env, jclass obj, jlong handle, jint p){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetAMotorAngleRate");
#endif
	return dJointGetAMotorAngleRate(joint(handle),p);
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetAMotorParam (JNIEnv *env, jclass obj, jlong handle, jint p){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetAMotorParam");
#endif
	return dJointGetAMotorParam(joint(handle),p);
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetAMotorMode (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetAMotorMode");
#endif
	return dJointGetAMotorMode(joint(handle));
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetLMotorNumAxes (JNIEnv *env, jclass obj, jlong handle){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetLMotorNumAxes");
#endif
	return dJointGetLMotorNumAxes(joint(handle));
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetLMotorAxis (JNIEnv *env, jclass obj, jlong handle, jint a, jfloatArray arr){
	float *res=new float[3];
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetLMotorAxis");
#endif
	dJointGetLMotorAxis(joint(handle),a,res);
	env->SetFloatArrayRegion(arr,0,3,res);
	delete res;
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetLMotorParam (JNIEnv *env, jclass obj, jlong handle, jint p){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetLMotorParam");
#endif
	return dJointGetLMotorParam(joint(handle),p);
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dJointGetFixedParam (JNIEnv *env, jclass obj, jlong handle, jint p){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dJointGetFixedParam");
#endif
	return dJointGetFixedParam(joint(handle),p);
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_dConnectingJoint (JNIEnv *env, jclass obj, jlong handle, jlong handle2){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dConnectingJoint");
#endif
	return (jlong)dConnectingJoint(body(handle),body(handle2));
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dConnectingJointList (JNIEnv *env, jclass obj, jlong handle, jlong handle2, jlongArray arr){
	dJointID *list=toJointArray(env,arr);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dConnectingJointList");
#endif
	return dConnectingJointList(body(handle),body(handle2),list);
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dAreConnected (JNIEnv *env, jclass obj, jlong handle, jlong handle2){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dAreConnected");
#endif
	return dAreConnected(body(handle),body(handle2));
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dAreConnectedExcluding(JNIEnv *env, jclass obj, jlong handle, jlong handle2, jint t){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dAreConnectedExcluding");
#endif
	return dAreConnectedExcluding(body(handle),body(handle2),t);
}

// end of joint

// init

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dInitODE (JNIEnv *env , jclass obj){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dInitODE");
#endif
	dInitODE();
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dInitODE2 (JNIEnv *env , jclass obj, jint flags){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dInitODE2");
#endif
	return dInitODE2(flags);
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dAllocateODEDataForThread (JNIEnv *env , jclass obj, jint flags){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dAllocateODEDataForThread");
#endif
	return dAllocateODEDataForThread(flags);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dCleanupODEAllDataForThread (JNIEnv *env , jclass obj){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dCleanupODEAllDataForThread");
#endif
	dCleanupODEAllDataForThread();
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dCloseODE (JNIEnv *env , jclass obj){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dCloseODE");
#endif
	dCloseODE();
}

// timer

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dTimerStart (JNIEnv *env , jclass obj, jstring str){
	jboolean iscopy;
	const char *desc=env->GetStringUTFChars(str,&iscopy);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dTimerStart");
#endif
	dTimerStart(desc);
	env->ReleaseStringUTFChars(str,desc);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dTimerNow (JNIEnv *env , jclass obj, jstring str){
	jboolean iscopy;
	const char *desc=env->GetStringUTFChars(str,&iscopy);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dTimerNow");
#endif
	dTimerNow(desc);
	env->ReleaseStringUTFChars(str,desc);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dTimerEnd (JNIEnv *env , jclass obj){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dTimerEnd");
#endif
	dTimerEnd();
}

JNIEXPORT jdouble JNICALL Java_com_paranoidmonkey_ode_AndrODE_dTimerTicksPerSecond (JNIEnv *env , jclass obj){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dTimerTicksPerSecond");
#endif
	return dTimerTicksPerSecond();
}

JNIEXPORT jdouble JNICALL Java_com_paranoidmonkey_ode_AndrODE_dTimerResolution (JNIEnv *env , jclass obj){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dTimerResolution");
#endif
	return dTimerResolution();
}

// -------------------------------------------------------------------------------------------------------------------------------------------

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_dInfinity(JNIEnv *env, jclass obj){
	return dInfinity;
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dCollide__JJJ(JNIEnv *env, jclass obj,jlong o1,jlong o2,jlong contact){
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dCollide (simple) %llx,%llx",o1,o2);
#endif
	return dCollide(geom(o1),geom(o2),1,&((dContact*)contact)->geom,sizeof(dContact));
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dCollide done");
#endif
}

void copyContact(dContactGeom *dst,jlong Src){
	dContactGeom *src=(dContactGeom*)Src;

	memcpy(dst,src,sizeof(dContactGeom));
}
void copyContact(jlong Dst,dContactGeom *src){
	dContactGeom *dst=(dContactGeom*)Dst;

	memcpy(dst,src,sizeof(dContactGeom));
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dCollide__JJI_3J(JNIEnv *env, jclass obj, jlong o1, jlong o2, jint flags, jlongArray arr){
	int len=env->GetArrayLength(arr);
	jlong *larr=new jlong[len];
	env->GetLongArrayRegion(arr,0,len,larr);
	dContactGeom *contacts=new dContactGeom[len];
	for (int i=0;i<len;i++){
		copyContact(&contacts[i],larr[i]);
	}

#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dCollide %llx,%llx",o1,o2);
#endif
	int res=dCollide(geom(o1),geom(o2),flags,contacts,sizeof(dContact));
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dCollide done");
#endif

	for (int i=0;i<len;i++){
		copyContact(larr[i],&contacts[i]);
	}

	delete larr;
	return res;
}

JNIEXPORT jfloatArray JNICALL Java_com_paranoidmonkey_ode_AndrODE_getFeedback(JNIEnv *env, jclass obj, jlong id){
	dJointFeedback *f=(dJointFeedback*)id;
	float arr[16];
	arr[0]=(float)f->f1[0];
	arr[1]=(float)f->f1[1];
	arr[2]=(float)f->f1[2];
	arr[3]=(float)f->f1[3];

	arr[4]=(float)f->f2[0];
	arr[5]=(float)f->f2[1];
	arr[6]=(float)f->f2[2];
	arr[7]=(float)f->f2[3];

	arr[8]=(float)f->t1[0];
	arr[9]=(float)f->t1[1];
	arr[10]=(float)f->t1[2];
	arr[11]=(float)f->t1[3];

	arr[12]=(float)f->t2[0];
	arr[13]=(float)f->t2[1];
	arr[14]=(float)f->t2[2];
	arr[15]=(float)f->t2[3];
	return fromCArray(env,arr,16);
}

void copy(dVector4 *V,float *f){
	dReal *v=(dReal*)V;

	v[0]=(dReal)f[0];
	v[1]=(dReal)f[1];
	v[2]=(dReal)f[2];
	v[3]=(dReal)f[3];
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_setFeedback(JNIEnv *env, jclass obj, jlong id, jfloatArray f1, jfloatArray f2, jfloatArray t1, jfloatArray t2){
	dJointFeedback *f=(dJointFeedback*)id;
	float *F1=toCArray(env,f1);
	float *F2=toCArray(env,f2);
	float *T1=toCArray(env,t1);
	float *T2=toCArray(env,t2);

	copy(&(f->f1),F1);
	copy(&(f->f2),F2);
	copy(&(f->t1),T1);
	copy(&(f->t2),T2);
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_CreateContact(JNIEnv *env, jclass obj){
	dContact *contact=new dContact();
	return (jlong)contact;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_DestroyContact(JNIEnv *env, jclass obj,jlong id){
	dContact *contact=(dContact*)id;
	delete contact;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_contactSetFdir(JNIEnv *env, jclass obj, jlong id,jfloatArray arr){
	dContact *contact=(dContact*)id;
	env->SetFloatArrayRegion(arr,0,3,(float*)&(contact->fdir1));
}
JNIEXPORT jfloatArray JNICALL Java_com_paranoidmonkey_ode_AndrODE_contactGetFdir(JNIEnv *env, jclass obj, jlong id){
	dContact *contact=(dContact*)id;
	float *vec=contact->fdir1;
	jfloatArray arr=env->NewFloatArray(3);
	env->GetFloatArrayRegion(arr,0,3,vec);
	return arr;
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_contactgeomGetContactGeom(JNIEnv *env, jclass obj, jlong id){
	dContact *contact=(dContact*)id;
	return (jlong)&(contact->geom);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_contactgeomSetDepth(JNIEnv *env, jclass obj, jlong id,jfloat depth){
	dContactGeom *cg=(dContactGeom*)id;
	cg->depth=depth;
}
JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_contactgeomSetG1(JNIEnv *env, jclass obj, jlong id,jlong g1){
	dContactGeom *cg=(dContactGeom*)id;
	cg->g1=(dGeomID)g1;
}
JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_contactgeomSetG2(JNIEnv *env, jclass obj, jlong id,jlong g2){
	dContactGeom *cg=(dContactGeom*)id;
	cg->g2=(dGeomID)g2;
}
JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_contactgeomSetNormal(JNIEnv *env, jclass obj, jlong id,jfloatArray arr){
	dContactGeom *cg=(dContactGeom*)id;
	env->GetFloatArrayRegion(arr,0,3,(float*)&(cg->normal));
}
JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_contactgeomSetPos(JNIEnv *env, jclass obj, jlong id,jfloatArray arr){
	dContactGeom *cg=(dContactGeom*)id;
	env->GetFloatArrayRegion(arr,0,3,(float*)&(cg->pos));
}

JNIEXPORT jfloat JNICALL Java_com_paranoidmonkey_ode_AndrODE_contactgeomGetDepth(JNIEnv *env, jclass obj, jlong id){
	dContactGeom *cg=(dContactGeom*)id;
	return cg->depth;
}
JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_contactgeomGetG1(JNIEnv *env, jclass obj, jlong id){
	dContactGeom *cg=(dContactGeom*)id;
	return (jlong)cg->g1;
}
JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_contactgeomGetG2(JNIEnv *env, jclass obj, jlong id){
	dContactGeom *cg=(dContactGeom*)id;
	return (jlong)cg->g2;
}
JNIEXPORT jfloatArray JNICALL Java_com_paranoidmonkey_ode_AndrODE_contactgeomGetNormal(JNIEnv *env, jclass obj, jlong id){
	dContactGeom *cg=(dContactGeom*)id;
	return fromCArray(env,(float*)&(cg->normal),3);
}
JNIEXPORT jfloatArray JNICALL Java_com_paranoidmonkey_ode_AndrODE_contactgeomGetPos(JNIEnv *env, jclass obj, jlong id){
	dContactGeom *cg=(dContactGeom*)id;
	return fromCArray(env,(float*)&(cg->pos),3);
}

JNIEXPORT jlong JNICALL Java_com_paranoidmonkey_ode_AndrODE_contactGetSurface(JNIEnv *env, jclass obj, jlong id){
	dContact *contact=(dContact*)id;
	return (jlong)&(contact->surface);
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_SurfaceParametersSetBounce(JNIEnv *env, jclass obj, jlong id,jfloat bounce){
	dSurfaceParameters *sp=(dSurfaceParameters*)id;
	sp->bounce=bounce;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_SurfaceParametersSetBounceVel(JNIEnv *env, jclass obj, jlong id,jfloat bounce){
	dSurfaceParameters *sp=(dSurfaceParameters*)id;
	sp->bounce_vel=bounce;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_SurfaceParametersSetMode(JNIEnv *env, jclass obj, jlong id,jint mode){
	dSurfaceParameters *sp=(dSurfaceParameters*)id;
	sp->mode=mode;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_SurfaceParametersSetMotion1(JNIEnv *env, jclass obj, jlong id,jfloat m){
	dSurfaceParameters *sp=(dSurfaceParameters*)id;
	sp->motion1=m;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_SurfaceParametersSetMotion2(JNIEnv *env, jclass obj, jlong id,jfloat m){
	dSurfaceParameters *sp=(dSurfaceParameters*)id;
	sp->motion2=m;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_SurfaceParametersSetMotionN(JNIEnv *env, jclass obj, jlong id,jfloat m){
	dSurfaceParameters *sp=(dSurfaceParameters*)id;
	sp->motionN=m;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_SurfaceParametersSetMu(JNIEnv *env, jclass obj, jlong id,jfloat m){
	dSurfaceParameters *sp=(dSurfaceParameters*)id;
	sp->mu=m;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_SurfaceParametersSetMu2(JNIEnv *env, jclass obj, jlong id,jfloat m){
	dSurfaceParameters *sp=(dSurfaceParameters*)id;
	sp->mu2=m;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_SurfaceParametersSetSlip1(JNIEnv *env, jclass obj, jlong id,jfloat m){
	dSurfaceParameters *sp=(dSurfaceParameters*)id;
	sp->slip1=m;
}
JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_SurfaceParametersSetSlip2(JNIEnv *env, jclass obj, jlong id,jfloat m){
	dSurfaceParameters *sp=(dSurfaceParameters*)id;
	sp->slip2=m;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_SurfaceParametersSetSoftCFM(JNIEnv *env, jclass obj, jlong id,jfloat m){
	dSurfaceParameters *sp=(dSurfaceParameters*)id;
	sp->soft_cfm=m;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_SurfaceParametersSetSoftERP(JNIEnv *env, jclass obj, jlong id,jfloat m){
	dSurfaceParameters *sp=(dSurfaceParameters*)id;
	sp->soft_erp=m;
}

JNIEXPORT float JNICALL Java_com_paranoidmonkey_ode_AndrODE_SurfaceParametersGetBounce(JNIEnv *env, jclass obj, jlong id){
	dSurfaceParameters *sp=(dSurfaceParameters*)id;
	return sp->bounce;
}

JNIEXPORT float JNICALL Java_com_paranoidmonkey_ode_AndrODE_SurfaceParametersGetBounceVel(JNIEnv *env, jclass obj, jlong id){
	dSurfaceParameters *sp=(dSurfaceParameters*)id;
	return sp->bounce_vel;
}

JNIEXPORT float JNICALL Java_com_paranoidmonkey_ode_AndrODE_SurfaceParametersGetMode(JNIEnv *env, jclass obj, jlong id,jint mode){
	dSurfaceParameters *sp=(dSurfaceParameters*)id;
	return sp->mode;
}

JNIEXPORT float JNICALL Java_com_paranoidmonkey_ode_AndrODE_SurfaceParametersGetMotion1(JNIEnv *env, jclass obj, jlong id,jfloat m){
	dSurfaceParameters *sp=(dSurfaceParameters*)id;
	return sp->motion1;
}

JNIEXPORT float JNICALL Java_com_paranoidmonkey_ode_AndrODE_SurfaceParametersGetMotion2(JNIEnv *env, jclass obj, jlong id,jfloat m){
	dSurfaceParameters *sp=(dSurfaceParameters*)id;
	return sp->motion2;
}

JNIEXPORT float JNICALL Java_com_paranoidmonkey_ode_AndrODE_SurfaceParametersGetMotionN(JNIEnv *env, jclass obj, jlong id,jfloat m){
	dSurfaceParameters *sp=(dSurfaceParameters*)id;
	return sp->motionN;
}

JNIEXPORT float JNICALL Java_com_paranoidmonkey_ode_AndrODE_SurfaceParametersGetMu(JNIEnv *env, jclass obj, jlong id,jfloat m){
	dSurfaceParameters *sp=(dSurfaceParameters*)id;
	return sp->mu;
}

JNIEXPORT float JNICALL Java_com_paranoidmonkey_ode_AndrODE_SurfaceParametersGetMu2(JNIEnv *env, jclass obj, jlong id,jfloat m){
	dSurfaceParameters *sp=(dSurfaceParameters*)id;
	return sp->mu2;
}

JNIEXPORT float JNICALL Java_com_paranoidmonkey_ode_AndrODE_SurfaceParametersGetSlip1(JNIEnv *env, jclass obj, jlong id,jfloat m){
	dSurfaceParameters *sp=(dSurfaceParameters*)id;
	return sp->slip1;
}
JNIEXPORT float JNICALL Java_com_paranoidmonkey_ode_AndrODE_SurfaceParametersGetSlip2(JNIEnv *env, jclass obj, jlong id,jfloat m){
	dSurfaceParameters *sp=(dSurfaceParameters*)id;
	return sp->slip2;
}

JNIEXPORT float JNICALL Java_com_paranoidmonkey_ode_AndrODE_SurfaceParametersGetSoftCFM(JNIEnv *env, jclass obj, jlong id,jfloat m){
	dSurfaceParameters *sp=(dSurfaceParameters*)id;
	return sp->soft_cfm;
}

JNIEXPORT float JNICALL Java_com_paranoidmonkey_ode_AndrODE_SurfaceParametersGetSoftERP(JNIEnv *env, jclass obj, jlong id,jfloat m){
	dSurfaceParameters *sp=(dSurfaceParameters*)id;
	return sp->soft_erp;
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dFactorCholesky(JNIEnv *env, jclass obj, jfloatArray arr, jint n){
	float *A=toCArray(env,arr);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dFactorCholesky");
#endif
	jint res=dFactorCholesky(A,n);
	delete A;
	return res;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dSolveCholesky(JNIEnv *env, jclass obj, jfloatArray arr, jfloatArray arr2, jint n){
	float *L=toCArray(env,arr);
	float *b=toCArray(env,arr2);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dSolveCholesky");
#endif
	dSolveCholesky(L,b,n);
	env->SetFloatArrayRegion(arr2,0,env->GetArrayLength(arr2),b);
	delete L;
	delete b;
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dInvertPDMatrix(JNIEnv *env, jclass obj, jfloatArray arr, jfloatArray arr2, jint n){
	float *A=toCArray(env,arr);
	float *Ainv=toCArray(env,arr2);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dInvertPDMatrix");
#endif
	jint res=dInvertPDMatrix(A,Ainv,n);
	env->SetFloatArrayRegion(arr2,0,env->GetArrayLength(arr2),Ainv);
	delete A;
	delete Ainv;
	return res;
}

JNIEXPORT jint JNICALL Java_com_paranoidmonkey_ode_AndrODE_dIsPositiveDefinite(JNIEnv *env, jclass obj, jfloatArray arr, jint n){
	float *A=toCArray(env,arr);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dIsPositiveDefinite");
#endif
	jint res=dIsPositiveDefinite(A,n);
	delete A;
	return res;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dFactorLDLT(JNIEnv *env, jclass obj, jfloatArray arr1, jfloatArray arr2, jint n, jint skip){
	float *A=toCArray(env,arr1);
	float *d=toCArray(env,arr2);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dFactorLDLT");
#endif
	dFactorLDLT(A,d,n,skip);
	env->SetFloatArrayRegion(arr1,0,env->GetArrayLength(arr1),A);
	env->SetFloatArrayRegion(arr2,0,env->GetArrayLength(arr2),d);
	delete A;
	delete d;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dSolveL1(JNIEnv *env, jclass obj, jfloatArray arr1, jfloatArray arr2, jint n, jint skip){
	float *L=toCArray(env,arr1);
	float *b=toCArray(env,arr2);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dSolveL1");
#endif
	dSolveL1(L,b,n,skip);
	env->SetFloatArrayRegion(arr2,0,env->GetArrayLength(arr2),b);
	delete L;
	delete b;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dSolveL1T(JNIEnv *env, jclass obj, jfloatArray arr1, jfloatArray arr2, jint n, jint skip){
	float *L=toCArray(env,arr1);
	float *b=toCArray(env,arr2);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dSolveL1T");
#endif
	dSolveL1T(L,b,n,skip);
	env->SetFloatArrayRegion(arr2,0,env->GetArrayLength(arr2),b);
	delete L;
	delete b;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dVectorScale(JNIEnv *env, jclass obj, jfloatArray arr1, jfloatArray arr2, jint n){
	float *a=toCArray(env,arr1);
	float *d=toCArray(env,arr2);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dVectorScale");
#endif
	dVectorScale(a,d,n);
	env->SetFloatArrayRegion(arr1,0,env->GetArrayLength(arr1),a);
	delete d;
	delete a;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dSolveLDLT(JNIEnv *env, jclass obj, jfloatArray arr1, jfloatArray arr2, jfloatArray arr3, jint n, jint skip){
	float *L=toCArray(env,arr1);
	float *d=toCArray(env,arr2);
	float *b=toCArray(env,arr3);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dSolveLDLT");
#endif
	dSolveLDLT(L,d,b,n,skip);
	env->SetFloatArrayRegion(arr3,0,env->GetArrayLength(arr3),b);
	delete L;
	delete d;
	delete b;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dLDLTAddTL(JNIEnv *env, jclass obj, jfloatArray arr1, jfloatArray arr2, jfloatArray arr3, jint n, jint skip){
	float *L=toCArray(env,arr1);
	float *d=toCArray(env,arr2);
	float *a=toCArray(env,arr3);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dLDLTAddTL");
#endif
	dLDLTAddTL(L,d,a,n,skip);
	env->SetFloatArrayRegion(arr1,0,env->GetArrayLength(arr1),L);
	env->SetFloatArrayRegion(arr2,0,env->GetArrayLength(arr2),d);
	delete L;
	delete d;
	delete a;
}

JNIEXPORT void JNICALL Java_com_paranoidmonkey_ode_AndrODE_dLDLTRemove(JNIEnv *env, jclass obj, jobjectArray Aarr, jintArray parr, jfloatArray Larr, jfloatArray darr, jint n1, jint n2, jint r, jint skip){
	int Alen=env->GetArrayLength(Aarr);
	float **A=new float*[Alen];
	for (int i=0;i<Alen;i++){
		jfloatArray line=(jfloatArray)env->GetObjectArrayElement(Aarr,i);
		A[i]=toCArray(env,line);
	}

	int *p=toCArray(env,parr);
	float *L=toCArray(env,Larr);
	float *d=toCArray(env,darr);
#ifdef __VERBOSE
	__android_log_print(ANDROID_LOG_VERBOSE,"AndrODE (native)","dLDLTRemove");
#endif
	dLDLTRemove(A,p,L,d,n1,n2,r,skip);

	for (int i=0;i<Alen;i++){
		jfloatArray line=(jfloatArray)env->GetObjectArrayElement(Aarr,i);
		env->SetFloatArrayRegion(line,0,env->GetArrayLength(line),A[i]);
		delete A[i];
	}

	delete A;
	delete p;
	delete L;
	delete d;
}
